View Full Version : Creating .lib file from a Dll
MikeTrader
20-10-2009, 08:39
Assuming you want to integrate a Dll in a language like C++, you will need to create a .lib file for the linker to know how to call the exported functions. The calling convention can be STDCALL or CDECL (which is somewhat standard).
There are several techniques to accomplish this and before I write my own I thought I would see if anyone has been down this road before.
if you mean how to convert dll to lib ; before several weeks i have converted a dll to a lib like this:
polib libgmp-3.dll /machine:ix86 /out:libgmp-3.lib
polib.exe is the pelles library manager, pelles c is a freeware development kit for Windows : http://www.smorgasbordet.com/pellesc/
i have found this file "polib.exe" in the folders of many programming languages.
there is also another older method, if i remebmer it i will post it.
regards
MikeTrader
22-10-2009, 09:14
Yes Pelle's excellent polib is probably the best choice once the .Def file is made. I guess I will just have to write this part (extracting the functions from the PE header) and then shell to polib.
i haven't used a DEF file, i have just tried it with the above dll.
anyway there is a very old file called:
Borland Impdef Version 3.0.1 (c) 1991, 1998
i have attached it, for making the DEF file write:
impdef.exe libgmp-3.dll.def libgmp-3.dll
then using the LIB.exe from VC++6.0; or Open Watcom C/C++ LIB:
LIB /def:LIBGMP-3.dll.def /out:LIBGMP-3.LIB
i have just tried it successfully.
i can't determine if those old utilities are successfull with the modern dlls made by visual studio 2005-2008 or not, but it is successfull with the modern libgmp-3.dll made this year.