libtool
[Top][All Lists]
Advanced

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

Difficulties with dlpreopen interface


From: Ineiev
Subject: Difficulties with dlpreopen interface
Date: Tue, 14 Apr 2009 11:35:13 +0400

Hello;

My goal was to use in an application two
versions of the same library simultaneously.
this may be needed to reproduce bit-to-bit
renderings made with older versions and to
use newer versions for the library for new
objects in the same piece of work.

First, I built two shared modules, each wrapping-around
it's version of the encapsulated library and lt_dlopened
them (a sample is at
http://ineiev.users.sourceforge.net/samples/libex.tar.gz)

This worked like a charm - under decent systems, I mean;
though when configured with --disable-shared, it just
does't open the libraries; and cygwin simply refused
to link the application.

Then I thought that perhaps dlpreopened modules could do this.
I wrote in configure.ac

AC_CONFIG_AUX_DIR([libltdl/config])
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])
LT_CONFIG_LTDL_DIR([libltdl])
AC_CONFIG_MACRO_DIR([libltdl/m4])
AC_LIB_LTDL
LTDL_INIT()

and in Makefile.am

ACLOCAL_AMFLAGS=-I libltdl/m4
bin_PROGRAMS=dlpo
lib_LTLIBRARIES=lib0.la lib1.la
lib0_la_CPPFLAGS=-DLIB_NAME="\"lib0\""
lib0_la_SOURCES=lib.c lib.h lib.sym
lib0_la_LDFLAGS=-module lib.c -export-symbols @srcdir@/lib.sym
lib1_la_CPPFLAGS=-DLIB_NAME="\"lib1\""
lib1_la_SOURCES=lib.c lib.h lib.sym
lib1_la_LDFLAGS=-module lib.c -export-symbols @srcdir@/lib.sym
dlpo_SOURCES=dlpo.c lib.h
dlpo_CPPFLAGS=$(AM_CPPFLAGS) $(LTDLINCL) -DPACKAGE_LIB_DIR="\"$(libdir)\""
dlpo_LDFLAGS=-dlpreopen lib0.la -dlpreopen lib1.la $(LIBLTDL)

The build stopped on
.libs/dlpoS.o(.rodata+0x14): undefined reference to `bar'
.libs/dlpoS.o(.rodata+0x1c): undefined reference to `foo'
.libs/dlpoS.o(.rodata+0x34): undefined reference to `bar'
.libs/dlpoS.o(.rodata+0x3c): undefined reference to `foo'

(The full project is at
http://ineiev.users.sourceforge.net/samples/dlpo.tar.gz)

I used libtool-2.2.6a.

BTW once I was confused by libtool.info claim
struct lt_dlsymlist
{const char *ORIGINATOR; const lt_dlsymbol SYMBOLS[];}
the header says it is a typedef,
GCC insists it is not the same;
and there is no `originator' field;
there is certainly something that I don't understand;
however, then I realized that the application is not
linked even if I don't touch any of these.

I have never had a chance to dig into libtool so deeply;
there are so many possibilities that I'm absolutely lost
(wrong libtool version; incorrect libtool/autotools setup;
 invalid _FLAGS or macros invocations;
 probably I should define lt_dlsymlist in my sources;
 and may be this tool is not for such things at all).

Any ideas?

Thanks,
     Ineiev




reply via email to

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