-
Dll
How do I make it so when my project's header is included, it will make the recipient project know that their is an accompying DLL? For example when you include SDL.h in a project it automatically knows about SDL.dll. Also, my project is an .h and a .dll. Most projects have .libs, .h and .dll. What's the lib for and how do I make one?
-
libs are for statically (compile-time) linking object code whereas dlls are for dynamic (run-time) linking. compilers like vc++ and dev-c++ allow you to create projects for both, but you can also find independant tools out there that can generate them from obj files. a search engine would be a good starting point to find out all the options to you.
-
The dll projects I compile with Microsoft compilers produce both a dll and a .lib. The application program links with the .lib to resolve the external references contained in the dll. Then the application program just calls the functions contained in the dll as if they were part of the application. Most microsoft dlls work that way.
There is another way to accomplish that without the .lib, but its a little more complicated for the application program -- see MSDN for win32 api function LoadLibrary().
Visual Studio 2003/2005 compilers have yet another method for managed c++, but I haven't started learning that yet, and probably won't for several more years.
-
Thanks, so but how do I make it look for the dll the normal automatic way? (not LoadLibrary)
And how do I need to declare the functions so that a lib will be created?
-
>> Thanks, so but how do I make it look for the dll the normal automatic way?
that depends on the compiler you're using - you'll need to look the documentation.
>> And how do I need to declare the functions so that a lib will be created?
a lib is simply a file format that contains multiple obj files. again, how to generate the lib and how to access the functions in it will depend on your compiler.
-
>>Thanks, so but how do I make it look for the dll the normal automatic way? (not LoadLibrary)
When your program starts, MS-Windows os looks for the dll in either your program's startup directory or in one of the directories in the PATH environment variable.