www.digitalmars.com         C & C++   DMDScript  

c++ - making a .dll file from .lib file

reply New C++ Student <New_member pathlink.com> writes:
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???
Jul 16 2005
next sibling parent "Walter" <newshound digitalmars.com> writes:
"New C++ Student" <New_member pathlink.com> wrote in message
news:dbbcvf$1s9j$1 digitaldaemon.com...
 ok heres a newbie question - Im new ti C++ I have the .lib file and the .h

 - how do I make a dll file from the .lib file???

You need to pick up the book "Advanced Windows" by Jeffrey Richter. Here's a link: http://www.amazon.com/exec/obidos/ASIN/1572315482/classicempire What DLLs are and how to program them is not something that can be explained in a few sentences. Richter's book has everything you need to know about DLLs in it.
Jul 16 2005
prev sibling parent mx0 seznam.cz writes:
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)
Jul 25 2005