[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: static lib containing backends
From: |
Ralf Wildenhues |
Subject: |
Re: static lib containing backends |
Date: |
Tue, 7 Feb 2006 09:54:38 +0100 |
User-agent: |
Mutt/1.5.11 |
Hi Yannick,
* Yannick Lecaillez wrote on Sat, Feb 04, 2006 at 01:37:52PM CET:
>
> I'm working on a library which load some backends for do its job.
> Here the current scheme :
>
> Application
> |
> lib A <----------+
> | |
> +-----> lib Backend
>
> Application is linked against lib A only. Lib A load dynamicly (using
> lt_dlopenext()) a lib Backend defined at runtime. lib Backend use some
> struct manipulation function (like myStructGetName(),
> myStructGetType()) supplied by lib A.
>
> Everything works pretty well in a shared lib environment.
This is not true. Everything works well in ELF shared library
environments. Your setup breaks in shared library environments
where undefined symbols are not allowed at link time. This includes
AIX without runtimelinking, and win32 systems, for example.
The usual way to solve this is described in the CVS version of the
Libtool manual, in the node 'Linking with dlopened modules'. You could
download the CVS snapshot to read it, or, more lazily, read it at
http://cvs.savannah.gnu.org/viewcvs/*checkout*/libtool/doc/libtool.texi?content-type=text%2Fplain&root=libtool
(short: factor out the struct manipulation in an interface library).
> The problem i have is i want a lib A staticly linked against all lib
> Backend available. The problem is about inter-library dependency. I
> read in libtool documentation about libtool doesn't link static lib
> but rather write dependency in libA.la file.
This depends on the system, but yes, on some it does this.
> Then when Application need to be linked staticly, libtool read this
> .la file and staticly link application like this :
>
> Application
> |
> +------+-----+--------+
> | | |
> lib A lib Backend 1 lib Backend n
Right, in that case.
> I want be able to supply a static lib A which doesn't depend on any
> .la file and which contain all backend staticly :
>
> lib A
> |
> +---------+--------+
> | |
> lib Backend 1 lib Backend n
Why do you want to be able to do that?
> Is there a way to do that properly using libtool ? How do you solve
> such problem ? I
> tried something like this :
>
> lib_LTLIBRARIES = libA.la
> libA_la_SOURCES = src1.c src2.c backend_symbols.c
> libA_la_LDFLAGS = -version 1.0.0
> libA_la_LIBADD += ../backends/back1.lo \
> ../backends/back2.lo \
> ../backends/back3.lo
This is not correct. Maybe I can suggest something better (that also
does not need backend_symbols.c), but I would like to understand the
problem you are really trying to solve first.
Is your interest that users of libA will not use libtool at all?
Cheers,
Ralf
- static lib containing backends, Yannick Lecaillez, 2006/02/04
- Re: static lib containing backends,
Ralf Wildenhues <=
- Re: static lib containing backends, Yannick Lecaillez, 2006/02/07
- Re: static lib containing backends, Ralf Wildenhues, 2006/02/07
- Re: static lib containing backends, Yannick Lecaillez, 2006/02/08
- Re: static lib containing backends, Ralf Wildenhues, 2006/02/09
- Re: static lib containing backends, Bob Friesenhahn, 2006/02/09
- Re: static lib containing backends, Ralf Wildenhues, 2006/02/09
- Re: static lib containing backends, Bob Friesenhahn, 2006/02/09
- Re: static lib containing backends, Peter Ekberg, 2006/02/11
- msvs support (was: static lib containing backends), Ralf Wildenhues, 2006/02/12