Subject: Re: help with using windows dll
From: "Gerrit P. Haase" <[email-masked]>
To: Frank Motta <[email-masked]>
Cc: [email-masked]
Date: Wed, 10 Apr 2002 22:09:55 +0200

> -------- Original Message --------
> Subject: =?iso_8859_1?Q?can_a_pre-built_library_be_used=3F?=
> From: "Frank Motta" <fmotta at embedded-guru dot com>
> To: <cygwin at cygwin dot com>

> I have a third party lib/dll (x.lib, x.dll) built with microsoft tools
> I need to link to a cygwin application.

> Since cygwin can't use the .lib then is there a way of extracting the
> equivilent stubs from the .lib or the dll?

>     Is this possible?

>     If so, how!!!

I used to do this with a tool that comes with libtool.
It isn't provided in binary form with the libtool setup,
but gets build everytime it is needed by libtool.
I've it on a website to fetch it for others (just the
C source and the compiled binary).

I use it with this stupid script which is invoked like this,

        $ libextract /path/DLLNAME

where DLLNAME is the dllname without .dll:

#!/usr/bin/sh
echo $0 creates import library $1.dll.a from $*.dll
DLLNAME=$@

/bin/impgen ${DLLNAME}.dll >${DLLNAME}.def
dlltool --as=as --dllname ${DLLNAME}.dll --def ${DLLNAME}.def --output-lib ${DLLNAME}.dll.a
# ENDE

Extract the 'impgen' source from ltmain.sh or fetch it here:
http://timtowtdi.topcities.com/cygwin/impgen/

My script needs some improvements since importlibraries are usually
named in another fashion.  Here cygbz21.0.dll gets cygbz21.0.dll.a as
importlib where the real one is named libbz2.dll.a.
But you can either link directely to the name you created the importlib
with or rename it as you like it.

Also I should mention that it works with some Windows dll's and with
others it doesn't work and I don't know why.

Gerrit
-- 
=^..^=

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/