Is anyone aware of a program that will convert .lib to .dll?

There are several programs on Google that will convert .dll to .lib but none the other way.

In using FASM, it is much easier for me to deal with a .dll when I want to link to a library which has no source code given.
Posted on 2003-07-21 00:25:48 by msmith


Is anyone aware of a program that will convert .lib to .dll?


What about a compiler/linker?



There are several programs on Google that will convert .dll to .lib but none the other way.

In using FASM, it is much easier for me to deal with a .dll when I want to link to a library which has no source code given.


If you have the prototypes for the functions in that *.lib you can build a stub file which calls those functions or maybe you could just create a *.def file and list the public exports. Given that you didn't provide more specific details I can't be more precise.
The conclusion is that the lib file is just a collection of object files which you link to a exe/dll.

// CyberHeg
Posted on 2003-07-21 04:47:10 by CyberHeg
Hi msmith,

You can use Microsofts LIB.EXE to extract the OBJ file you need from the LIB file:

LIB.EXE /EXTRACT:export.obj LibFile.LIB

export.obj is normally just the name of the export with .OBJ appended. At that point you can include the object file in your linker's command. This is preferable to the DLL method IMHO. If you don't have a copy of LIB.EXE you can get it from Hutch's MASM32 or email me and I'll send it along.
Posted on 2003-07-21 05:46:43 by donkey
if he has an easier time dealing with a DLL than a .lib, a .obj wouldn't be much better.
Let me guess, using fasm "standalone", without a linker, thus wanting to import from DLL.

If you have a .lib, you should have some prototypes too (asm, C, whatever) - so, you should be able to build a dummy DLL like CybH suggests. I think iczelion had a little documentation on how to deal with this, or perhaps it was the other way around - building an import library from a DLL.
Posted on 2003-07-21 08:48:59 by f0dder
Another interesting program is the DLL to static lib converter. :)
Is there anyone who tried it?
Posted on 2003-07-21 09:23:41 by Vortex
I've tried dll2lib or whatever, and it crashed on most stuff that weren't trivial :/
Posted on 2003-07-21 10:30:19 by f0dder
Donkey,

I get the following error:LIB : warning LNK4014: cannot find member object...

f0dder,

You don't have to guess FASM..., I said that's what I was doing.
Posted on 2003-07-21 10:38:35 by msmith
You may have the wrong name for the obj file. Use LIB.EXE /LIST LibFile.LIB to get the names of all of the OBJ files contained in the library.
Posted on 2003-07-21 12:26:02 by donkey
Hi Donkey,

One of us must have misunderstood.



You can use Microsofts LIB.EXE to extract the OBJ file you need from the LIB file:

LIB.EXE /EXTRACT:export.obj LibFile.LIB

export.obj is normally just the name of the export with .OBJ appended. At that point you can include the object file in your linker's command. This is preferable to the DLL method IMHO.



I ONLY have the .LIB. I have no .obj. I thought you were showing me how to make a .obj from the .LIB.

Mike
Posted on 2003-07-21 15:17:02 by msmith
msmith,

A lib file is a collection of object files and a symbol table, not much more to it than that. The symbol table is contained in a IMAGE_ARCHIVE_MEMBER_ HEADER structure with the offsets to the OBJ files. Each object file is extractable from the library using the LIB.EXE utility.

Given a LIB file you must first determine the contents of the file:

LIB.EXE /LIST LibFile.lib

This will give you a list of all of the obj files contained in the lib file:

export1.obj
export2.obj
export3.obj
export4.obj

Once you have a list of object files you extract the one you want using:

LIB.EXE /EXTRACT:export1.obj LibFile.lib

This will give you an object file that you can include in your project.
Posted on 2003-07-21 15:57:08 by donkey
Hi Donkey,

I see now. This works the same as the .a and .o files in Unix/Mingw32/gcc/ld etc. Our older OmniBasic version uses all this (It has static linking only). The ar program is like the lib program. This is all great except I never did learn to do dll's in gcc land, so I can't extrapolate how to get a dll from either the .lib file or its .obj children.

If there were a utility to make a dll from a .lib it would surely know how to get the constituent .obj's and make them into dll(s). I would settle for one composite dll or one dll per obj as long as I could have the dll's export list corresponding to the object file's external symbols.

Are you saying that once I have each .obj file, I can use link to make a dll from it?

Please advise.
Posted on 2003-07-21 16:11:30 by msmith
I've never tried to build a dll from a lib before but it should be possible. You would need a dll entry and link the object files to it. The list of exports would have to match the actual function names in the object files. I would have to write an example to test it. When I get home I'll take a look at the problem and get back to you, could you possible email me an example lib file so we are working on the same formats.
Posted on 2003-07-21 16:17:57 by donkey