Linking against .lib libraries

Earnie Boyd
Sun Sep 6 02:41:00 GMT 1998

---Serge Torres <> wrote:
> Hi,
> I'm trying to build a dll wich has a code written and compiled with
> and at the last stage has to be linked it a .lib library from
> I need this combination to create a dll that implements new extended
> procedures
> I have manged to link to the library but I get a lot of warnings
> duplicate  section `.text`" as mentioned, in a not very different
context by
> Berend Ozceri from Istanbul.
> The dll is definetly unworkable, it will not be loaded by SQL SERVER
> when viewed under an hex editor will show a lot of source code
> I think I've understood that .lib file format is not compatible with
> format.
> Is it ture ? 

Yes it is true, at least for the moment.

> Is it really impossible to link cygwin (egcs 2.0.1) generated
against .lib libraries ? 

Yes it is impossible to link against the .lib files.

> Is it really hopeless ? 

No it is not hopeless.  You can use `nm' and `dlltool' to create a
libsomelib.a from the somelib.lib file.  I the exactly what to do.  I
did post it a while back.

Basically you need to create a somelib.def file from the `nm
--defined-only --demangle somelib.lib | grep ' [DCT] ' > somelib.def'.
 Then add `EXPORTS' as the first line to the file.  Then use dlltool
to create the libsomelib.a file.

I hope my memory is serving me correctly.  If this doesn't work take a
look at the impdef tool on Colin Peters' page.  It will create a def
output based on the .dll but when I tried this it wasn't giving me the
correct stuff.

> I would not like to have to move back to VC.

I haven't even been there yet.

> Thanks
> Serge Torres
> Centre National de Documentation Pedagogique

-        \\||//

Get your free address at

For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list