libtool
[Top][All Lists]
Advanced

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

Re: linking modules into programs problem


From: Michael Matz
Subject: Re: linking modules into programs problem
Date: Mon, 19 Mar 2001 15:34:01 +0100 (MET)

Hi,

On Mon, 19 Mar 2001, Nick Hudson wrote:
> >
> >  Isn't this, what the "$need_lib_prefix" (or how it's called, I can't
> check
> >  right now) variable is all about?  To force the actual filenames to be
> >  libfrob.*, although the .la files is frob.la?  Then NetBSD/a.out should
> >  set that.
>
> OK, here's the problem...
>
> Setting need_lib_prefix to yes forces every module to be prefixed with lib.

Yep, that's it's job.

> This is counter intuitive as dlopen("module.so") works so why should libtool
> force it to be called libmodule.so?

But we use lt_dlopen("module.la"), which does the right thing, even if the
.so is called libmodule.so.  (In fact we are doing more checks to find the
right file, but even standard libltdl should work).

> Having need_lib_prefix to yes does allow modules to be linked into
> libraries and binaries, but again this is counter intuitive as
> libraries are linked in not modules.

I agree in some way.  But libtool's purpose is to behave everywhere the
same way (as circumstances permit), and as on some platforms modules can
be linked...  As I view it, modules are just a shared component, as are
libraries, so there is no reason, why modules should _not_ be linkable.
How the real files are called is transparent to users of libtool (and
should not interest them in any way ;) For me, the ideal world would be,
that modules and libs are exactly the same (in behaviour), just that only
modules can be lt_dlopen'ed.  In fact libtool also tries to present this
view (by dependency tracking, supporting .la files without lib prefix,
-module merely a switch, and so on).

Given, there are some fundamental differences, e.g. if only static linking
is available, all to be ld_dlopen'ed modules need to be mentioned in the
link command, but for KDE we have the fundamental requirement to be able
to build shared things, so we don't do this, and let libltdl do the work.

> I would agree with Alexandre and say that libtool should issue a warning or
> error if something attempt's to link in a module.

But on many systems this is allowed, so an error would seem strange.  And
given, that libtool can mimic this behaviour also on platforms needing lib
prefix, why should it barf?  OK, I also have another reason ;) : If
libtool would prevent modules from being linked into executables, we would
link many of our (KDE-) modules two time (as modules and as lib), thereby
doubling the binary size, for no good reason (and all the Makefile.am
would need fixing, doh ;) )

> What's the best way of getting this "fixed" in KDE?

Does $need_lib_prefix have other issues?  If not, then that's the
solution.  If it _does_ have issues (I could guess, the run-time-path
doesn't get encoded, or the wrong one does, or similar strange things),
then we have a problem, because the above actions would need to take
place ;(


Ciao,
Michael.




reply via email to

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