I am trying to build a DLL which uses libltdl for dynamic loading of
other libtool modules. As a result I am first building libltdl as a
"convenience library" using
...
AC_LIBLTDL_CONVENIENCE
AC_SUBST(INCLTDL)
AC_SUBST(LIBLTDL)
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
AC_CONFIG_SUBDIRS(libltdl)
...
in my configure.ac. My DLL is then built with
INCLUDES = @INCLTDL@
lib_LTLIBRARIES = libname.la
libname_la_SOURCES = ...
libname_la_LDFLAGS = -no-undefined -avoid-version
libname_la_LIBADD = @LIBLTDL@
All builds without error, however, on Windows under MinGW 3.1.0 and Msys
1.0.9 using
automake 1.82.
autoconf 2.59
libtool 1.5.2
the resulting export library "libname.dll.a" does not contain any
exported symbols other than those provided by libltdl (ex:
lt_dlsym...lt_dladderror). The libtool link and resulting gcc commands
presented by the `make` are paraphased below:
/bin/sh libtool --mode=link gcc -g -O2 -o libname.la -rpath ...
-no-undefined -avoid-version file.lo libltdl/libltdlc.la
gcc -shared .libs/file.o -Wl,--whole-archive libltdl/.libs/libltdlc.a
-Wl,--no-whole-archive -o .libs/libname.dll -Wl,--image-base=0x10000000
-Wl,--out-implib,.libs/libname.dll.a
Again, the library is created, there just aren't any exported symbols
from file.o. However, if I instead manually link without the
"--whole-archive" of the convenience library and simply use the ltdl
object file
gcc -shared .libs/file.o libltdl/ltdl.o -o .libs/libname.dll
-Wl,--image-base=0x10000000 -Wl,--out-implib,.libs/libname.dll.a
The import library libname.dll.a contains the symbols for libltdl as
well as those of file.o as expected.
Any help as to what I am doing wrong is greatly appreciated.
wtj