Subject: RE: using libtool to create dll's with cygwin
From: Gary Vaughan <[email-masked]>
To: "Kevin Wright" <[email-masked]>
Cc: [email-masked]
Date: Mon, 12 Feb 2001 20:06:28 +0000

On Fri, 09 Feb 2001, Kevin Wright wrote:
> Gary,
> 
> Thanks very much for your reply. FYI. When you cc'd [email-masked] did
> you mean to post to the cygwin list? If you did, it didn't get to the list.
> Perhaps you meant to send it to [email-masked].

Doh!  Hopefully rectified this time.   Thanks.

	Cheers,
		Gary.

> --Kevin
> 
> > -----Original Message-----
> > From: Gary V. Vaughan [mailto:[email-masked]]On Behalf Of Gary
> > V. Vaughan
> > Sent: Thursday, February 08, 2001 1:03 PM
> > To: Kevin Wright
> > Cc: [email-masked]; [email-masked]
> > Subject: Re: using libtool to create dll's with cygwin
> >
> >
> > On Wed, Feb 07, 2001 at 03:15:29PM -0700, Kevin Wright wrote:
> > > Gary,
> > >
> > > First, I want to thank you for your excellent book on GNU autotools.
> > > I'm learning a great deal from it.
> >
> > Thanks.  I pleased that you like it -- but I can't take all the
> > credit, Ben, Tom and Ian wrote almost half of the pages in it.  I am
> > Cc:ing a couple of the lists that will probably be interested in the
> > rest of this conversation.  I hope you don't mind.
> >
> > > The question I have is: you mention in the book (p. 320) that
> > DJ Delorie
> > > is working on gcc go link DLLs in a single pass...
> > >
> > > I believe he is done because you can use gcc -shared to create a DLL:
> > >
> > > OBJS=foo
> > > BASE=foo
> > >
> > >   gcc -shared -o lib$(BASE).dll -Wl,--out-implib=lib$(BASE).dll.a \
> > >     -Wl,--export-all -Wl,--enable-auto-image-base  \
> > >     -Wl,--output-def=lib$(BASE)_.def $(OBJS)
> >
> > It is even easier than that (from memory):
> >
> >     gcc -shared -o cyg${BASE}.dll
> > -Wl,--out-implib=lib${BASE}.dll.a $(OBJS)
> >
> > > so, have you been able to keep up with the latest cygwin releases
> > > (1.1.8) and are you aware of the progress made with gcc?
> >
> > Indeed.  DJ finished the work long before the book went to press, but
> > it took a while for his modifications to filter through to the
> > standard gcc binaries shipped with cygwin.  The import library
> > generator in libtool is based off his code in fact.
> >
> > > I'm trying to build shared libraries with cygwin using libtool but I
> > > doesn't quite seem to be automatic. (I'm using the latest cvs sources
> > > of libtool, automake, autoconf, etc.)
> >
> > DLL support is slightly broken at the moment in CVS libtool.  I
> > will add an item to my TODO list on
> > http://savannah.gnu.org/projects/libtool,
> > to make sure that I schedule fixing that before releasing libtool 1.4.
> > What I really want to do is set up a macro that tests for the one pass
> > linkage feature, and uses that in preference to libtool's current
> > (hairy, but portable) scheme.  There is an interesting (and very long)
> > debate in the cygwin archives involving Paul Sokolovsky, Chuck Wilson,
> > myself and others regarding how libtool should integrate with cygwin.
> >
> > > I'm currently able to create DLL's manually but struggle a bit with
> > > how to change the headers to use __declspec(dllimport) and
> > > __declspec(dllexport).
> >
> > The declspec thing is an absolute nightmare.  Microsoft have tried
> > extremely hard to make it impossible to build a dll and a static lib
> > from the same sources.  The only way around it is the hideous dance of
> > the #ifdefs.  The scheme I described in the book is very baroque, but
> > has worked for me with the `sic' project in the goat book, my
> > snprintfv library and several CVS versions of GNU m4 (probably not the
> > current head), along with dynamic runtime loading of modules in all of
> > these cases.
> >
> > > I'd like to be able to use libtool to create the DLL's with
> > just a bit of
> > > manual modification to the headers for the dllimport & dllexport stuff.
> >
> > I can (and will) definitely do that -- with the caveat that
> > interlibrary dependencies are hopelessy under-featured on Windows.  I
> > have found that it is often necessary to move functions around so that
> > there are no unsatisfied symbols in the dll itself.
> >
> > What I would really like is to have autoconf projects ``just work'' (tm),
> > but the DLL and ELF shared library architectures  are way too
> > different for that to happen without a new runtime loader.  That is an
> > enormous undertaking, and I fear that the chances of it happening are
> > vanishingly small.  With the next release of libtool, it will be
> > possible to get pretty close by specifying -no-undefined to libtool,
> > and a bit of #ifdef black-magic in the header files.  The difficult
> > part will be persuading upstream developers to work this way; or
> > accept patches into the upstream sources to `fix' building of dlls.
> >
> > > TIA,
> > >
> > > --Kevin Wright
> > >
> > > Sunnyvale, California
> >
> > Cheers,
> > 	Gary.
> > --
> >   ___              _   ___   __              _         mailto:
> > [email-masked]
> >  / __|__ _ _ ___ _| | / / | / /_ _ _  _ __ _| |_  __ _ ___
> > [email-masked]
> > | (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
> >  \___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
> > home page:  /___/                      /___/                  gpg
> > public key:
> > http://www.oranda.demon.co.uk
> > http://www.oranda.demon.co.uk/key.asc
> >
-- 
  ___              _   ___   __              _         mailto: [email-masked]
 / __|__ _ _ ___ _| | / / | / /_ _ _  _ __ _| |_  __ _ ___       [email-masked]
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
 \___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
home page:  /___/                      /___/                  gpg public key:
http://www.oranda.demon.co.uk           http://www.oranda.demon.co.uk/key.asc

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple