| |
|
mx0
Posted in reply to New C++ Student
| In article <dbbcvf$1s9j$1@digitaldaemon.com>, New C++ Student says...
>
>ok heres a newbie question - Im new ti C++ I have the .lib file and the .h file - how do I make a dll file from the .lib file???
>
>
- first, you will (probably) need the same compiler (and maybe the same version
of that compiler) as in the .lib was generated
- it will AFAIK be possible to build the dll from that lib the same way as building from objects (because the lib are basically only objects joined together)
- you will need to export symbols from dll some way (see __declspec(dllexport/dllimport) in e.g. MSVC, I don't know about dmc, while I didn't build any dll in dmc yet), so you may need to modify the header, or use def file to export symbols from dll
- you will not need to rebuild the lib in most cases, AFAIK
- but, you must really take care about calling convention (__cdecl, __pascal, __stdcall etc.), that is very important (C-symbols are exported from dlls mostly in __cdecl convention, but you can specify the calling convention in the header) - if you want to use the lib without rebuild, you have to use the same calling convention as the compiler used to build the lib (you may need to specify the convention explicitly, especially in the case you use __declspec(dllexport/dllimport) and/or .def file, the convention is not specified and the compiler uses default calling convention other than __cdecl)
- inline methods and templates can cause problems (multiply defined or missing symbols when linking .dll with .exe)
|