![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Basically, what I want to do is create a load of functions in C++, compile them into a DLL and create a header file that sorts it all out for the user, without having a gazillion different .H files in the Include folder. Unfortunately, I have no clue how to do this. I'm using Visual Studio .NET at the mo, but I don't mind using something else if it'll help.
Anyone with half a brain that can explain all this to me? -- Oobs. |
|
|
|
|
|
#2 |
|
Programmer
|
You could release it as a set of libraries, or you could include them with each project you do.
Make the DLL and the header file, and then just include them like you would normal libraries with your project and distribute them with your software. Oh, when you create a project you have the option of making it a DLL.
__________________
ALLOW IMAGES IN SIGNATURES NOW |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
That's what I plan to do. The question is, how? I think I know how to build a DLL in VS (I'll check it out later and post back), but how do I link to functions in the header file?
|
|
|
|
|
|
#4 | |
|
Programmer
|
Quote:
__________________
ALLOW IMAGES IN SIGNATURES NOW |
|
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
I'm pretty sure you need to specify the DLL - at least, you do in VB. And I'm not sure how it would work without it. There must be some way to do it. I've found this guide, but I'm not sure how to apply this to what I want to do - create a couple of libraries that all my apps can use.
|
|
|
|
|
|
#6 |
|
Expert Programmer
|
There are several options for this, the easiest is probably to use the create a new DLL project with MSVC and let it works is magic, all you have to do is include the .H file in which you have exported your API and link the proper libraries with it.
Another solution, which may be better is to compile a DLL file (without generating a .lib file to go along with it), and than write a header file which exports code that will dynamically load the library via LoadLibrary( ), and provide an interface to each exported object in the DLL. Look up CMRLib on http://www.cliffordroche.com, there is a class in there MDLLProxy which pretty much does that, you can probably rip that template out into a single .H file (or even two .H files) and work with it. Good luck.
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
So you're saying I can just write some functions, compile it as a DLL and load the stuff using LoadLibrary? Sounds easy enough, though no doubt it'll be harder in practice.
One more question - how can I create a class in that DLL and use it in my program? Is it even possible? |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|