libtool
[Top][All Lists]
Advanced

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

static lib containing backends


From: Yannick Lecaillez
Subject: static lib containing backends
Date: Sat, 04 Feb 2006 13:37:52 +0100
User-agent: Mozilla Thunderbird 1.0.6-7.4.20060mdk (X11/20050322)

Hi,

   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. 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. 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

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

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

backend_symbols.c is a hand made file containing the lt_preloaded_symbols of the backend's entry point. i was unable to let libtool generate this file since it ignore -dlpreopen stuff for archive.

This produce a libA.a which contains all backend staticly linked and works fine. But this lib
still need libA.la be available. How to remove this dependency ?

   Is some one have some clue how to achieve that correctly ?

   Regards,
   Yannick.








reply via email to

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