Building import lib(.a) from windows lib(.lib)

Kazunori Higuchi higuchi@cov.tytlabs.co.jp
Thu Sep 14 18:30:00 GMT 2000


Hi,

I want to link a Windows library(.lib) with gcc on WinNT Cygwin-b20.1.
(The library(.lib) does not come with .dll nor .def file.)

I could find the following FAQ in the Cygwin FAQ site
( http://sources.redhat.com/cygwin/faq/ ), but I could not trace its
procedure since I'm new to Windows programings.  Could anyone give me
some more details or example for creating a .a file from a .lib file?

> How do I link against .lib files?
> 
> (Please note: This section has not yet been updated for the latest net release.) 
> 
> 1. Build a C file with a function table. Put all functions you intend to use in that table. This forces the linker to include all the object files from
> the .lib. Maybe there is an option to force LINK.EXE to include an object file. 2. Build a dummy 'LibMain'. 3. Build a .def with all the exports
> you need. 4. Link with your .lib using link.exe. 
> 
> or 
> 
> 1. Extract all the object files from the .lib using LIB.EXE. 2. Build a dummy C file referencing all the functions you need, either with a direct
> call or through an initialized function pointer. 3. Build a dummy LibMain. 4. Link all the objects with this file+LibMain. 5. Write a .def. 6. Link. 
> 
> You can use these methods to use MSVC (and many other runtime libs) with Cygwin development tools. 
> 
> Note that this is a lot of work (half a day or so), but much less than rewriting the runtime library in question from specs... 
> 
> (thanks to Jacob Navia (root@jacob.remcomp.fr) for this explanation) 

Thanks in advance, -- Kaz

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list