[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making shared libraries (DLLs) on Windows: -no-undefined

From: Ralf Wildenhues
Subject: Re: Making shared libraries (DLLs) on Windows: -no-undefined
Date: Mon, 30 Apr 2007 14:05:23 +0200
User-agent: Mutt/1.5.15 (2007-04-13)

* John Brown wrote on Mon, Apr 30, 2007 at 01:27:42PM CEST:
> Brian Dessent <brian <at>> writes:
> > 
> > Libtool will *not* create shared libraries without -no-undefined on PE
> > targets, period.
> <cut>
> >  So yes, you
> > need to either use -no-undefined unconditionally, or conditionalized on
> > PE targets.  See
> > <> for a little
> > of the history.

> I am not really convinced that this behaviour is right.

It is how libtool currently works.  Period.  There may be something to
discuss whether this is the best imaginable solution, but not whether
this is how it currently works.

> It looks like discrimination against users of the evil M$ O/S ,

Even if it were: the amount of extra work needed to port applications
using shared libraries (that already work seemless on a dozen unix-like
systems) would very much be worth such a discrimination.  There is no
discrimination against users, though.  I don't see how end-users come
into play here.  Developers of software to be run on w32 do.  Roughly
20% of the script text of (the input from which libtool is
generated) just deals with w32-specific hacks, bugs, and warts.  As long
as I have done Libtool maintenance, more than a third of the work has
been devoted to w32 systems alone.

Note that with some luck, you can just pass

to libtool on about any system.  At least with C, there should be few
issues.  (Not so sure about C++.)

> but I know nothing about
> writing programs for multiple platforms, so I cannot argue.

So let yourself be convinced, please.

> Just for my information:
> I gather that on Linux, you *can* create a shared library with
> undefined symbols.


> 1) Why would anyone do that intentionally?

Good question.  To allow circular references in shared libraries, for
example.  Some unportable hacks are other examples.  My impression is
that most library authors do not do it.

> 2) Assuming that it was a mistake, could it happen silently?

Yes.  The GNU binutils linker has '-z defs', but it doesn't work too
well with GNU libc (IIRC; I think that falls into the category
'unportable hacks').  Which is why libtool does not make use of it.

> 3) What are the consequences?

If you take care that symbols are provided at the time a program that
uses the library starts (or a module is loaded), then there are no bad
consequences on GNU/Linux.

Hope that helps.  Apologies if this sounded like a rant; if it did, then
it wasn't directed at you (or anyone else, FWIW) personally.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]