Jump to content
Posted 19 July 2012 - 11:18 AM
Posted 19 July 2012 - 11:26 AM
From How To Create 32-bit Import Libraries Without .OBJs or Source
Given a .DLL with functions exported via a C interface, you can create an import library by following these steps:
- Use DUMPBIN /EXPORTS <.DLL file name> to obtain the list of exported symbols for the .DLL in question. The symbols appear in the "name" column of the table whose headings are "ordinal hint name."
- Create a .DEF file that contains an EXPORTS section with the names of the functions listed in the "name" column of the DUMPBIN output.
- For _cdecl functions, the symbol appears just as it would when used in the calling program. Just place this symbol in the EXPORTS section of the .DEF file.
- Use LIB /DEF:<.DEF file name> to generate the import library and exports file. The base name of the import library will be the base name of the .DEF file. Use /OUT: to control the output library name.
Edited by Cornstalks, 19 July 2012 - 11:35 AM.
Posted 19 July 2012 - 03:10 PM
Posted 19 July 2012 - 04:14 PM
Posted 19 July 2012 - 04:46 PM
Sorry, I don't know why I assumed that. Here's a link for doing it for MinGW.
I forgot to mention I'm using MinGW/GCC 4.6.3, not Visual Studio.
Hmmm... you'll have to make sure the command parameters are exactly the same. For example, if you're using make, you can do make V=1 to see what the exact command is for linking things, and then just copy 'n' paste the linking command with the changes you need. Usually ld or ar are used in linking stuff. If you're using ld, just change the output DLL name (and be sure to pass --out-implib file to generate an import library (.a) (or you can pass --output-def file which will make a definitions file (.def) that can be used to make an import library later)). If you're using ar, you're make a static library so an import library is useless and it won't make one, so no need to worry about this one. Another common linking tool is libtool, but I have less experience with that.
@Cornstalks: I do have the compiled .o files, the .a with the wrong name, and the compiled .dll.
Excellent idea re-linking the objects. Just tried it on a few, after some monkeying around, and I think it's working, though sometimes the filesizes being outputted are different (sometimes by more than a little) from the original DLLs Boost generated making me think some of the symbols are being missed.
Posted 19 July 2012 - 06:49 PM
Posted 19 July 2012 - 07:36 PM
Edited by Servant of the Lord, 19 July 2012 - 07:37 PM.
Posted 19 July 2012 - 08:45 PM
Edited by krippy2k8, 19 July 2012 - 08:53 PM.
Posted 19 July 2012 - 10:54 PM