*** empty log message ***

This commit is contained in:
Thomas Tanner 1999-01-17 11:19:40 +00:00
parent 9f6e865761
commit 6b7c38b36c
15 changed files with 677 additions and 399 deletions

107
ChangeLog
View File

@ -1,3 +1,52 @@
1999-01-17 Thomas Tanner <tanner@gmx.de>
* Makefile.am: added libltdl.tar.gz to CLEANFILES
* ChangeLog: some reformatting
* TODO: documentation updates
* doc/libtool.texi: added preliminary libltdl documentation,
updated dlopen and -module documentation,
renamed -avoid-versioning to -avoid-version
documented the libtool script variables compiler_c_o,
compiler_o_lo, need_locks, old_postuninstall_cmds,
postuninstall_cmds, sys_lib_search_path_spec,
fix_srcfile_path, objdir, objext, libext,
documented the two new flags (--ltdl[-tar]) of libtoolize
* libltdl/Makefile.am: incremented the version, removed
libtool dependency so that it can be build independently
* libltdl/configure.in: removed LTDL_SHLIB_EXT hack,
set version to 1.0, use AM_MAINTAINER_MODE,
DLPREOPEN is always supported, check for libtool's objdir variable
(LTDL_OBJDIR)
* libltdl/ltdl.c: some cleanups (moved constants to the beginning
of the file and prefixed all of them with LTDL_, minor optimizations
in find_file() and find_module()), renamed lt_dlpreopen* to
lt_dlpreload* for consistency, removed LTDL_SHLIB_EXT hack,
we don't need unistd.h, DLPREOPEN is _always_ supported,
reverted Alexandre's lt_dlpreopen_default_ change,
try to open the not-installed module before the installed one,
replaced lt_dlsearchpath() with lt_dladdsearchdir(),
lt_dlsetsearchpath() and lt_dlgetsearchpath()
* libltdl/ltdl.h: renamed lt_dlpreopen* to lt_dlpreload*
for consistency, removed the declaration of lt_preloaded_symbols
(should be imported by programs),
reverted Alexandre's lt_dlpreopen_default_ change and added
two new macros LTDL_PRELOADED_SYMBOLS and
LTDL_SET_PRELOADED_SYMBOLS(),
added lt_dladdsearchdir(), lt_dlsetsearchpath() and
lt_dlgetsearchpath()
* libtool.m4: some reformatting
* libtoolize.in: implemented --ltdl, bugfix when checking for
the libtool package directory
* ltconfig.in: removed $thread_safe_flags from Andrey Slepuhin's
AIX patch, renamed sys_lib_search_path to sys_lib_search_path_spec,
some reformatting, fixed typo in deplibs_check_method (unkwnon)
* ltmain.in: documented -o for compile mode, some reformatting,
renamed -avoid-versioning to -avoid-version
renamed sys_lib_search_path to sys_lib_search_path_spec
* mdemo/Makefile.am: use -avoid-version
* mdemo/main.c: use LTDL_PRELOADED_SYMBOLS and
LTDL_SET_PRELOADED_SYMBOLS()
1999-01-17 Alexandre Oliva <oliva@dcc.unicamp.br>
* ltconfig.in (wlarc): set to either '${wl}' or an empty string,
@ -64,7 +113,7 @@
1999-01-14 Alexandre Oliva <oliva@dcc.unicamp.br>
* Makefile.am: Moved ltconfig and ltmain.sh back into srcdir, and
add them to the distribution. Added work-around if `mv -f' fails.
add them to the distribution. Added work-around if `mv -f' fails.
fix @AINCLUDE_M4_LIST@ and @DIST_MAKEFILE_LIST@ for relative and
absolute specifications of srcdir
@ -110,7 +159,7 @@
install only the necessary libtool scripts, not just all
files in pkgdatadir
* mdemo/Makefile.am: removed the rule for libltdl configuration
1999-01-13 Alexandre Oliva <oliva@dcc.unicamp.br>
* mdemo/Makefile.am (../libltdl/libtool): mkdir and configure
@ -165,7 +214,7 @@
libtool.m4, in last Alexandre Oliva's change to it
(sysv4*, ncr): pass all library dependencies
* ltmain.in (dependency_libs, -R): use `deplib' instead of `arg' to
iterate, otherwise we'd overwrite `arg'
iterate, otherwise we'd overwrite `arg'
(convenience, old_libs): if --disable-shared, convenience
libraries are just old archives, as .lo's are of no use
* tests/cdemo-static.test: print --disable-shared here
@ -188,7 +237,7 @@
* Makefile.am (@DIST_MAKEFILE_LIST@): `$' must be doubled
* configure.in (AC_CONFIG_DIRS): configure only libltdl, and then,
only if --enable-ltdl-install
only if --enable-ltdl-install
(CONF_SUBDIRS): list directories that are configured on demand,
but that must be included in the distribution
(ACINCLUDE_M4_LIST, DIST_MAKEFILE_LIST): generated from CONF_SUBDIRS
@ -278,7 +327,7 @@
documented that -rpath is not required for convenience libraries
* ltconfig.in (symxfrm): don't print $pipe_works twice, once for
each $ac_symprfx
each $ac_symprfx
Reported by Godmar Back <gback@cs.utah.edu>
* ltmain.in (convenience, libobjs): get only .o and .lo files from
@ -287,10 +336,10 @@
file, and therefore should not be fed to the linker
* libtool.m4 (AM_SYS_NM_PARSE): while we are at it, we may well
cache the value of ac_cv_sys_symbol_underscore
cache the value of ac_cv_sys_symbol_underscore
* libtool.m4 (AM_SYS_NM_PARSE): need for underscore prefix is now
auto-detected, by trying first without, then with it.
auto-detected, by trying first without, then with it.
* ltconfig.in: ditto
@ -321,7 +370,7 @@
most systems
(LT_SYMBOL_LENGTH): renamed from MAX_SYMBOL_LENGTH
(LT_SYMBOL_OVERHEAD): new macro, that accounts for the size of
the _LTX_ separator and the initial underscore
the _LTX_ separator and the initial underscore
(lt_dlsym): sym now points to a stack buffer (lsym) if possible,
or is dynamically allocated. If allocation fails, a
buffer_overflow_error is returned.
@ -397,8 +446,8 @@
1999-01-05 Alexandre Oliva <oliva@dcc.unicamp.br>
* ltmain.in (libobjs_save, oldobjs): when building an
old-fashioned archive, use a copy of libobjs saved before
convenience libraries are appended
old-fashioned archive, use a copy of libobjs saved before
convenience libraries are appended
* libltdl/ltdl.h (_LTDLL_EXPORT, _LTDLL_IMPORT): use cygwin or
unix library import/export primitives; this may be convenient for
@ -406,8 +455,8 @@
(_LTDLL_EXTERN): select _LTDLL_EXPORT or _LTDLL_IMPORT depending
on _LTDL_COMPILE_
* libltdl/ltdl.h, libltdl/ltdl.c (lt_dlpreopen): new function,
that replaces the current preloaded_symbols list with its
argument, and returns the old value, initially NULL
that replaces the current preloaded_symbols list with its
argument, and returns the old value, initially NULL
(dldpre_init): don't refer to dld_preloaded_symbols any more
(dldpre_open, dldpre_sym): search preloaded_symbols
(lt_dlpreopen_default): call lt_dlpreopen with
@ -438,11 +487,11 @@
would lose for files with embedded blanks.
* ltconfig.in (cygwin, archive_cmds, archive_sym_cmds): Moved
ltdll.c into ltmain.in, to avoid its duplication, and added a sed
script to extract it. Also, create def and base files in $objdir,
and don't remove them after the compilation.
ltdll.c into ltmain.in, to avoid its duplication, and added a sed
script to extract it. Also, create def and base files in $objdir,
and don't remove them after the compilation.
(cygwin, library_names_spec): Create static part of the dll with
suffix -dll.a, to avoid conflicts with actual static libraries.
suffix -dll.a, to avoid conflicts with actual static libraries.
* ltmain.in: Added ltdll.c, as commented out text
1999-01-01 Thomas Tanner <tanner@gmx.de>
@ -1641,11 +1690,11 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
longer distributed.
* tests/assign.test, if.test, test-e.test: Even though 15 tests looks
impressive, these are now redundant. Remove them from the
distribution.
impressive, these are now redundant. Remove them from the
distribution.
* tests/sh.test: Do what assign.test, if.test, and test-e.test used to
do.
do.
1998-02-16 Gordon Matzigkeit <gord@profitpress.com>
@ -1661,7 +1710,7 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
Stephan Kulow.
* tests/defs: Correctly identify absolute directory names on MS-DOS.
Suggested by Bob Friesenhahn.
Suggested by Bob Friesenhahn.
1998-02-11 Gordon Matzigkeit <gord@profitpress.com>
@ -2456,7 +2505,7 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
specified.
* tests/nomode.test: New test to make sure there is correct behaviour
when we don't specify a mode.
when we don't specify a mode.
1997-07-08 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
@ -2932,8 +2981,8 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
need to link against another library.
* tests/hardcode.test: Rewrite to use fgrep on output from ``strings
-a'' if using fgrep directly on the binary files fails. From Mark
Kettenis.
-a'' if using fgrep directly on the binary files fails. From Mark
Kettenis.
1997-01-28 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
@ -2973,14 +3022,14 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
Haible.
* tests/demo-conf.test: Use the CONFIG_SHELL environment variable when
running configure in the demo directory. From Bruno Haible.
running configure in the demo directory. From Bruno Haible.
* tests/Makefile.am (clean-local): Make distclean in the demo directory,
so that ``make clean; env CC=cc make check'' works as one would
expect.
* tests/demo-make.test: Fix typo (use $make instead of make). Reported
by Akim Demaille.
by Akim Demaille.
1997-01-17 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
@ -3037,7 +3086,7 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
* tests/demo-conf.test, tests/demo-inst.test, tests/demo-unst.test,
tests/hardcode.test:
Use $make instead of make.
Use $make instead of make.
* tests/defs (make): Add definition of $make that uses the $MAKE
environment variable, if set. Suggested by Bruno Haible.
@ -3086,8 +3135,8 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
line.
* tests/demo-unst.test: Don't fail if make uninstall doesn't delete
files beginning with a dot, since spurious .nfsXXX files may be
present when running NFS. Reported by Bruno Haible.
files beginning with a dot, since spurious .nfsXXX files may be
present when running NFS. Reported by Bruno Haible.
1997-01-02 Gordon Matzigkeit <gord@gnu.ai.mit.edu>
@ -3095,7 +3144,7 @@ Thu May 28 18:59:08 1998 Ian Lance Taylor <ian@cygnus.com>
Fortran and C++.
* tests/suffix.test: New test to guarantee that libtool compile
recognizes valid source file suffices.
recognizes valid source file suffices.
1996-12-17 Gordon Matzigkeit <gord@gnu.ai.mit.edu>

View File

@ -15,7 +15,7 @@ aclocal_macros = libtool.m4
EXTRA_DIST = $(aclocal_macros) libtoolize.in ltconfig.in ltmain.in \
libtool.spec
CLEANFILES = libtool libtoolize ltconfig.T ltmain.shT
CLEANFILES = libtool libtoolize ltconfig.T ltmain.shT libltdl.tar.gz
# These are required by libtoolize.
pkgdata_SCRIPTS = config.guess config.sub ltconfig
@ -31,7 +31,7 @@ bin_SCRIPTS = libtool libtoolize
libltdl.tar.gz: libltdl/Makefile
(cd libltdl && $(MAKE) dist)
rm -f libltdl.tar.gz
ln -s libltdl/libltdl-0.1.tar.gz libltdl.tar.gz
ln -s libltdl/libltdl-1.0.tar.gz libltdl.tar.gz
libtool: $(srcdir)/ltmain.sh $(srcdir)/ltconfig
CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \

1
NEWS
View File

@ -4,6 +4,7 @@ New in 1.2e: CVS version:
* Support -R for specifying run-time path of programs and library dependencies
* Support for BeOS
* Improved support for Win32, aix3, aix4, SysV 4.3, BSD/OS 4.x and NetBSD
* New -avoid-version option to avoid versioning for libraries
* Various bugfixes
New in 1.2c: CVS version; 1.2d: 1998-12-16, Libtool team:

12
TODO
View File

@ -53,17 +53,7 @@ work under Solaris however.
* Documentation:
- libltdl needs to be documented
- Some variables are still not documented in
"libtool script contents", namely:
compiler_c_o, compiler_o_lo, need_locks,
old_postuninstall_cmds, postuninstall_cmds,
old_archive_from_new_cmds, sys_lib_search_path,
fix_srcfile_path, objdir, objext, libext
- Some tests are only poorly documented:
assign.test, quote.test, sh.test
- libltdl documentation needs to be completed.
In the future:
**************

View File

@ -100,6 +100,7 @@ libtool.
* Library tips:: Tips for library interface design.
* Inter-library dependencies:: Libraries that depend on other libraries.
* Dlopened modules:: @code{dlopen}ing libtool-created libraries.
* Using libltdl:: Libtool's portable @code{dlopen} wrapper library.
* Other languages:: Using libtool without a C compiler.
* Troubleshooting:: When libtool doesn't work as advertised.
* Maintaining:: Information used by the libtool maintainer.
@ -170,6 +171,12 @@ Dlopened modules
* Finding the dlname:: Choosing the right file to @code{dlopen}.
* Dlopen issues:: Unresolved problems that need your attention.
Using libltdl
* Libltdl's interface:: How to use libltdl in your programs.
* Modules for libltdl:: Creating modules that can be @code{dlopen}ed.
* Distributing libltdl:: How to distribute libltdl with your package.
Using libtool with other languages
* C++ libraries::
@ -1135,7 +1142,7 @@ If @var{output-file} is a program, then do not link it against any
shared libraries at all. If @var{output-file} is a library, then only
create a static library.
@item -avoid-versioning
@item -avoid-version
Tries to avoid versioning (@pxref{Versioning}) for libraries and modules,
i.e. no version information is stored and no symbolic links are created.
If the platform requires versioning, this option has no effect.
@ -1173,10 +1180,10 @@ executable.
Creates a library that can be dlopenend (@pxref{Dlopened modules}).
This option doesn't work for programs and must not be used
together with @samp{-export-symbols}.
It implies the option @samp{-export-dynamic}.
It enables the option @samp{-export-dynamic} automatically.
Module names don't need to be prefixed with 'lib'.
In order to prevent name clashes, however, 'libname' and 'name'
must not be used at the same time.
must not be used at the same time in your package.
@item -no-undefined
Declare that @var{output-file} does not depend on any other libraries.
@ -1706,6 +1713,12 @@ overwrite existing files.
@item --help
Display a help message and exit.
@item --ltdl
Install libltdl in a subdirectory of your package.
@item --ltdl-tar
Add the file libltdl.tar.gz to your package.
@item --version
Print @code{libtoolize} version information and exit.
@end table
@ -2278,16 +2291,11 @@ interpreted language. In fact, dlopen calls are frequently used in
language interpreters to provide an efficient way to extend the
language.
As of version @value{VERSION}, libtool provides experimental support for
dlopened modules, which does not radically simplify the development of
dlopening applications. However, this support is designed to be a
portable foundation for generic, higher-level dlopen functions.
As of version @value{VERSION}, libtool provides support for
dlopened modules.
This chapter discusses the preliminary support that libtool offers, and
how you as a dlopen application developer might use libtool to generate
dlopen-accessible modules. It is important to remember that these are
experimental features, and not to rely on them for easy answers to the
problems associated with dlopened modules.
This chapter discusses how you as a dlopen application developer might
use libtool to generate dlopen-accessible modules.
@menu
* Building modules:: Creating dlopenable objects and libraries.
@ -2303,25 +2311,25 @@ On some operating systems, a program symbol must be specially declared
in order to be dynamically resolved with the @code{dlsym} (or
equivalent) function.
Libtool provides the @samp{-export-dynamic} link
flags (@pxref{Link mode}), which does this declaration.
You need to use this flag if you are linking an application program that
Libtool provides the @samp{-export-dynamic} and @samp{-module}
link flags (@pxref{Link mode}), which do this declaration.
You need to use these flags if you are linking an application program that
dlopens other modules or a libtool library that will also be dlopened.
For example, if we wanted to build a shared library, @file{libhello},
that would later be dlopened by an application, we would add
@samp{-export-dynamic} to the other link flags:
@samp{-module} to the other link flags:
@example
burger$ @kbd{libtool gcc -export-dynamic -o libhello.la foo.lo \
burger$ @kbd{libtool gcc -module -o libhello.la foo.lo \
hello.lo -rpath /usr/local/lib -lm}
burger$
@end example
Another situation where you would use @samp{-export-dynamic} is if
symbols from your @emph{executable} are needed to satisfy unresolved
references in a library you want to dlopen. In this case, you should
use @samp{-export-dynamic} while linking the executable that calls
If symbols from your @emph{executable} are needed to satisfy unresolved
references in a library you want to dlopen you will have to use the flag
@samp{-export-dynamic}.
You should use @samp{-export-dynamic} while linking the executable that calls
dlopen:
@example
@ -2365,7 +2373,7 @@ module, or the module is not found, then the application can recover
without crashing.
@end enumerate
Libtool emulates @samp{-export-dynamic}
Libtool emulates @samp{-export-dynamic} and @samp{-dlopen}
on static platforms by linking objects into the program at compile time,
and creating data structures that represent the program's symbol table.
@ -2373,15 +2381,13 @@ In order to use this feature, you must declare the objects you want your
application to dlopen by using the @samp{-dlopen} or @samp{-dlpreopen}
flags when you link your program (@pxref{Link mode}).
@deftypefn {Structure} {typedef struct}
lt_symbol @{ @w{const char *@var{name};} @w{lt_ptr_t @var{address};} @}
The @var{name} attribute is a zero-terminated character string of the
@deftypefn {Structure} {struct} lt_dlsymlist @{ @w{const char *@var{name};} @w{lt_ptr_t @var{address};} @}
The @var{name} attribute is a null-terminated character string of the
symbol name, such as @code{"fprintf"}. The @var{address} attribute is a
generic pointer to the appropriate object, such as @code{&fprintf}.
@end deftypefn
@deftypevar {const lt_symbol *} lt_preloaded_symbols
@deftypevar {const lt_dlsymlist *} lt_preloaded_symbols
An array of @var{lt_symbol} structures, representing all the preloaded
symbols linked into the program. For each @samp{-dlpreloaded} file
there is an element with the @var{name} of the file and a @var{address}
@ -2439,7 +2445,8 @@ The following problems are not solved by using libtool's dlopen support:
@item
Dlopen functions are generally only available on shared library
platforms. If you want your package to be portable to static platforms,
you have to develop your own alternatives to dlopening dynamic code.
you have to use either libltdl (@pxref{Using libltdl}) or develop your
own alternatives to dlopening dynamic code.
Most reasonable solutions involve writing wrapper functions for the
@code{dlopen} family, which do package-specific tricks when dlopening
is unsupported or not available on a given platform.
@ -2454,14 +2461,223 @@ The application developer must write a custom search function in order
to discover the correct module filename to supply to @code{dlopen}.
@end itemize
Libtool provides a small library, called @file{libltdl}, that aims at
hiding the various difficulties of dlopening libraries from programmers.
@node Using libltdl
@chapter Using libltdl
@findex libltdl
@findex dlopen
@findex dlsym
@findex dlclose
@findex dlerror
@findex shl_load
@cindex dynamic linking, applications
@cindex dlopening modules
@cindex modules, dynamic
@cindex application-level dynamic linking
Libtool provides a small library, called @file{libltdl}, that aims at
hiding the various difficulties of dlopening libraries from programmers.
It consists of a header-file and a small C source file that can be
distributed with applications that need dlopening functionality. Note,
however, that its experimental interface is not document and is subject
to change; use it at your own risk. On some platforms, whose dynamic
linkers are too limited for a simple implementation of @file{libltdl}
services, it will require GNU DLD.
distributed with applications that need dlopening functionality.
On some platforms, whose dynamic linkers are too limited for a simple
implementation of @file{libltdl} services, it requires GNU DLD.
@menu
* Libltdl's interface:: How to use libltdl in your programs.
* Modules for libltdl:: Creating modules that can be @code{dlopen}ed.
* Distributing libltdl:: How to distribute libltdl with your package.
@end menu
@node Libltdl's interface
@section How to use libltdl in your programs
@noindent
Libltdl's API is similar to the dlopen interface of Solaris and Linux,
which is very simple but powerful.
@noindent
To use libltdl in your program you have include the header file @file{ltdl.h}:
@example
#include <ltdl.h>
@end example
@noindent
Note that libltdl is not threadsafe, i.e. a multithreaded application
has to use a mutex for libltdl.
@noindent
The following types are defined by libltdl:
@table @code
@item lt_ptr_t
@code{lt_ptr_t} is a generic pointer.
@item lt_dlhandle
@code{lt_dlhandle} is a module "handle" used by @code{lt_dlopen},
@code{lt_dlclose} and @code{lt_dlsym}. Every dlopened module has
a handle associated with it.
@item lt_dlsymlist
@code{lt_dlsymlist} is a symbol list for dlpreopened modules.
This structure is described in @pxref{Dlpreopening} and is
used by @code{lt_dlpreload} and @code{lt_dlpreload_default}.
@end table
@noindent
Libltdl provides the following functions:
@deftypefun int lt_dlinit (void)
Initialize libltdl.
This function must be called before using libltdl
and may be called several times.
Return 0 on success, otherwise the number of errors.
@end deftypefun
@deftypefun int lt_dlexit (void)
Shut down libltdl and close all modules.
This function will only then shut down libltdl when it was called as
many times as @code{lt_dlinit} has been successfully called.
Return 0 on success, otherwise the number of errors.
@end deftypefun
@deftypefun lt_dlhandle lt_dlopen (const char *@var{filename})
Open the module with the file name @var{filename} and
return a handle for it.
The module can be either a libtool module
(the file name has a ".la" extension and the module was linked
using the @code{-module} flag) or a native dynamic library.
Unresolved symbols in the module are resolved using its dependency
libraries and previously dlopened modules.
If the executable using this module was linked with the @code{-export-dynamic}
flag, then the global symbols in the executable will also be used to
resolve references in the module.
Libltdl tries to resolve the symbols immediately and returns NULL
if that fails.
If libltdl cannot find the library and the file name @var{filename} does not
have a directory component it will additionally search in the following
search paths for the module (in the order as follows):
@enumerate 1
@item user-defined search path:
This search path can be set by the program using the
functions @code{lt_dlsetsearchpath} and @code{lt_dladdsearchdir}.
@item libltdl's search path:
This search path is the value of the environment variable
@var{LTDL_LIBRARY_PATH}.
@item system library search path:
The system dependent library search path
(e.g. on Linux it is @var{LD_LIBRARY_PATH}).
@end enumerate
Each search path must be a colon-separated list of absolute directories,
e.g. "/usr/lib/mypkg:/lib/foo".
If the same module is loaded several times, the same handle is returned.
If @code{lt_dlopen} fails for any reason, it returns NULL.
@end deftypefun
@deftypefun int lt_dlclose (lt_dlhandle @var{handle})
Decrement the reference count on the module @var{handle}.
If it drops to zero and no other module depends on this module,
then the module is unloaded.
Return 0 on success.
@end deftypefun
@deftypefun lt_ptr_t lt_dlsym (lt_dlhandle @var{handle}, const char *@var{name})
Return the address in the module @var{handle}, where the symbol given
by the null terminated string @var{name} is loaded.
If the symbol cannot be found, NULL is returned.
@end deftypefun
@deftypefun const char *lt_dlerror (void)
Return a human readable string describing the most
recent error that occurred from any of libltdl's functions.
Return NULL if no errors have occurred since initialization
or since it was last called.
@end deftypefun
@deftypefun int lt_dlpreload (const lt_dlsymlist *@var{preloaded})
Register the list of preloaded modules @var{preloaded}.
If @var{preloaded} is NULL, then all previously registered
symbol lists, except the list set by @code{lt_dlpreload_default},
are deleted. Return 0 on success.
@end deftypefun
@deftypefun int lt_dlpreload_default (const lt_dlsymlist *@var{preloaded})
Set the default list of preloaded modules to @var{preloaded},
which won't be deleted by @code{lt_dlpreload}.
Note that this function does *not* require libltdl to be initialized
using @code{lt_dlinit} and can be used in the program to register
the default preloaded modules.
Usually the main function in the program will set libtool's default
symbol list:
@example
extern const lt_dlsymlist lt_preloaded_symbols[];
...
lt_dlpreload_default(lt_preloaded_symbols);
@end example
Libltdl defines the macros @code{LTDL_PRELOADED_SYMBOLS} and
@code{LTDL_SET_PRELOADED_SYMBOLS}, which hide these libtool dependent
declaration for you.
Return 0 on success.
@end deftypefun
@deftypefun int lt_dladdsearchdir (const char *@var{search_dir})
Add the search directory @var{search_dir} to the user-defined library
search path. Return 0 on success.
@end deftypefun
@deftypefun int lt_dlsetsearchpath (const char *@var{search_path})
Replace the current user-defined library search path with
@var{search_path}. Return 0 on success.
@end deftypefun
@deftypefun const char *lt_dlgetsearchpath (void)
Return the current user-defined library search path.
@end deftypefun
@defmac LTDL_PRELOADED_SYMBOLS
Import libtool's preloaded symbols.
See @code{LTDL_SET_PRELOADED_SYMBOLS}.
@end defmac
@defmac LTDL_SET_PRELOADED_SYMBOLS()
Set the default list of preloaded symbols.
Should be used together with @code{LTDL_PRELOADED_SYMBOLS}
in your program to initialize libltdl's list of preloaded modules.
@example
LTDL_PRELOADED_SYMBOLS;
int main() @{
...
LTDL_SET_PRELOADED_SYMBOLS();
...
@}
@end example
@end defmac
@node Modules for libltdl
@section Creating modules that can be @code{dlopen}ed
empty
@node Distributing libltdl
@section How to distribute libltdl with your package
empty
@node Other languages
@chapter Using libtool with other languages
@ -3111,6 +3327,17 @@ Whether libtool should build static libraries on this system. Set to
@samp{yes} or @samp{no}.
@end defvar
@defvar compiler_c_o
Whether the compiler supports the @code{-c} and @code{-o} options
simultaneously. Set to @samp{yes} or @samp{no}.
@end defvar
@defvar compiler_o_lo
Whether the compiler supports compiling directly to a ".lo" file,
i.e whether object files do not have to have the suffix ".o".
Set to @samp{yes} or @samp{no}.
@end defvar
@defvar echo
An @code{echo} program which does not interpret backslashes as an
escape character.
@ -3130,6 +3357,10 @@ specific directory.
Same as @var{finish_cmds}, except the commands are not displayed.
@end defvar
@defvar fix_srcfile_path
Expression to fix the shell variable $srcfile for the compiler.
@end defvar
@defvar global_symbol_pipe
A pipeline that takes the output of @var{NM}, and produces a listing of
raw symbols followed by their C names. For example:
@ -3187,6 +3418,10 @@ For information purposes, set to the specified and canonical names of
the system that libtool was configured for.
@end defvar
@defvar libext
The standard old archive suffix (normally "a").
@end defvar
@defvar libname_spec
The format of a library name prefix. On all Unix systems, static
libraries are called @samp{lib@var{name}.a}, but on some systems (such
@ -3212,12 +3447,18 @@ about it.
@end defvar
@defvar need_version
Whether versioning is required for libraries.
Whether versioning is required for libraries, i.e. whether the
dynamic linker requires a version suffix for all libraries.
Set to @samp{yes} or @samp{no}. By default, it is @samp{unknown}, which
means the same as @samp{yes}, but documents that we are not really sure
about it.
@end defvar
@defvar need_locks
Whether files must be locked to prevent conflicts when compiling
simultaneously. Set to @samp{yes} or @samp{no}.
@end defvar
@defvar no_builtin_flag
Compiler flag to disable builtin functions that conflict with declaring
external global symbols as @code{char}.
@ -3229,6 +3470,14 @@ there will be no unresolved symbols in the resulting shared library.
Empty, if no such flag is required.
@end defvar
@defvar objdir
The name of the directory that contains temporary libtool files.
@end defvar
@defvar objext
The standard object file suffix (normally "o").
@end defvar
@defvar pic_flag
Any additional compiler flags for building library object files.
@end defvar
@ -3238,6 +3487,11 @@ Any additional compiler flags for building library object files.
Commands run after installing a shared or static library, respectively.
@end defvar
@defvar postuninstall_cmds
@defvarx old_postuninstall_cmds
Commands run after uninstalling a shared or static library, respectively.
@end defvar
@defvar reload_cmds
@defvarx reload_flag
Commands to create a reloadable object.
@ -3258,6 +3512,10 @@ The name coded into shared libraries, if different from the real name of
the file.
@end defvar
@defvar sys_lib_search_path_spec
Expression to get the system library search path.
@end defvar
@defvar version_type
The library version numbering type. One of @samp{libtool},
@samp{linux}, @samp{osf}, @samp{sunos}, or @samp{none}.

View File

@ -2,7 +2,7 @@
#
AUTOMAKE_OPTIONS = no-dependencies foreign
LTDL_VERSION = -version-info 1:0:1
LTDL_VERSION = -version-info 1:1:1
if INSTALL_LTDL
LTDL_FLAGS = $(LTDL_VERSION) -rpath $(libdir)
@ -20,12 +20,7 @@ noinst_LTLIBRARIES = @NOINSTLIBS@
libltdl_la_SOURCES = ltdl.c
libltdl_la_LDFLAGS = $(LTDL_FLAGS)
libltdl_la_LIBADD = $(LIBADD_DL)
libltdl_la_DEPENDENCIES = libtool
libltdlc_la_SOURCES = $(libltdl_la_SOURCES)
libltdlc_la_LDFLAGS =
libltdlc_la_LIBADD = $(libltdl_la_LIBADD)
libltdlc_la_DEPENDENCIES = libtool
libtool: ../libtool
./config.status --recheck

View File

@ -1,7 +1,9 @@
dnl Process this file with autoconf to create configure.
dnl Initialize the libltdl package.
AC_INIT(ltdl.c)
AM_INIT_AUTOMAKE(libltdl,0.1)
AM_INIT_AUTOMAKE(libltdl,1.0,-)
AM_MAINTAINER_MODE
AC_ARG_ENABLE(ltdl-install,
[--enable-ltdl-install install libltdl])
@ -19,28 +21,6 @@ AC_SUBST(NOINSTLIBS)
AC_PROG_CC
AM_PROG_LIBTOOL
AC_CACHE_CHECK([which extension is used for shared libraries],
libltdl_cv_shlibext, [dnl
(
rm -f conftest
./libtool --config > conftest
. ./conftest
last=
for spec in $library_names_spec; do
last="$spec"
done
rm -f conftest
changequote(, )
echo "$last" | sed 's/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
changequote([, ])
)
libltdl_cv_shlibext=`cat conftest`
rm -f conftest
])
if test x"$libltdl_cv_shlibext" != x""; then
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext")
fi
AC_CACHE_CHECK([which variable specifies run-time library path],
libltdl_cv_shlibpath_var, [dnl
(
@ -53,28 +33,30 @@ AC_CACHE_CHECK([which variable specifies run-time library path],
libltdl_cv_shlibpath_var=`cat conftest`
rm -f conftest
])
if test x"$libltdl_cv_shlibpath_var" != x""; then
if test -n "$libltdl_cv_shlibpath_var"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var")
fi
AC_CACHE_CHECK([for objdir],
libltdl_cv_objdir, [dnl
(
rm -f conftest
./libtool --config > conftest
. ./conftest
rm -f conftest
echo "$objdir" > conftest
)
libltdl_cv_objdir=`cat conftest`
rm -f conftest
])
test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir")
AC_HEADER_STDC
AC_CHECK_HEADERS(malloc.h memory.h stdlib.h unistd.h stdio.h ctype.h dlfcn.h dl.h)
AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h)
AC_CHECK_HEADERS(string.h strings.h, break)
AC_CHECK_FUNCS(strdup strchr strrchr index rindex)
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
libltdl_cv_dlpreopen, [dnl
if grep '^global_symbol_pipe=..*$' ./libtool >/dev/null; then
libltdl_cv_dlpreopen=yes
else
libltdl_cv_dlpreopen=no
fi
])
if test x"$libltdl_cv_dlpreopen" = x"yes"; then
AC_DEFINE(HAVE_DLPREOPEN)
fi
supported=yes
test_dlerror=no
LIBADD_DL=
AC_CHECK_FUNCS(dlopen, [AC_DEFINE(HAVE_LIBDL) test_dlerror=yes],

View File

@ -44,19 +44,40 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <stdlib.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#include "ltdl.h"
/* max. filename length */
#ifndef LTDL_FILENAME_MAX
#define LTDL_FILENAME_MAX 1024
#endif
#ifndef LTDL_SEARCHPATH_MAX
#define LTDL_SEARCHPATH_MAX 4096
#endif
#undef LTDL_READTEXT_MODE
/* fopen() mode flags for reading a text file */
#ifdef _WIN32
#define LTDL_READTEXT_MODE "rt"
#else
#define LTDL_READTEXT_MODE "r"
#endif
#undef LTDL_SYMBOL_LENGTH
/* This is the maximum symbol size that won't require malloc/free */
#define LTDL_SYMBOL_LENGTH 256
#undef LTDL_SYMBOL_OVERHEAD
/* This accounts for the _LTX_ separator and the string terminator */
#define LTDL_SYMBOL_OVERHEAD 6
static const char *unknown_error = "unknown error";
static const char *dlopen_not_supported_error = "dlopen support not available";
static const char *dlpreopen_not_supported_error = "dlpreopen support not available";
static const char *file_not_found_error = "file not found";
static const char *no_symbols_error = "no symbols defined";
static const char *symbol_error = "symbol not found";
@ -66,7 +87,6 @@ static const char *buffer_overflow_error = "internal buffer overflow";
static const char *shutdown_error = "library already shutdown";
static const char *last_error = 0;
static const char *usr_search_path = 0;
typedef struct lt_dltype_t {
struct lt_dltype_t *next;
@ -78,7 +98,7 @@ typedef struct lt_dltype_t {
lt_ptr_t (*find_sym) __P((lt_dlhandle handle, const char *symbol));
} lt_dltype_t, *lt_dltype;
#define LT_DLTYPE_TOP 0
#define LTDL_TYPE_TOP 0
typedef struct lt_dlhandle_t {
struct lt_dlhandle_t *next;
@ -245,7 +265,7 @@ dl_sym (handle, symbol)
{
lt_ptr_t address = dlsym(handle->handle, symbol);
if (!address)
if (!address)
last_error = dlerror();
return address;
}
@ -253,21 +273,21 @@ dl_sym (handle, symbol)
static
lt_dltype_t
#ifdef NEED_USCORE
dl = { LT_DLTYPE_TOP, "_", dl_init, dl_exit,
dl = { LTDL_TYPE_TOP, "_", dl_init, dl_exit,
dl_open, dl_close, dl_sym };
#else
dl = { LT_DLTYPE_TOP, 0, dl_init, dl_exit,
dl = { LTDL_TYPE_TOP, 0, dl_init, dl_exit,
dl_open, dl_close, dl_sym };
#endif
#undef LT_DLTYPE_TOP
#define LT_DLTYPE_TOP &dl
#undef LTDL_TYPE_TOP
#define LTDL_TYPE_TOP &dl
#endif
#if HAVE_SHL_LOAD
/* dynamic linking with shl_load (HP-UX) */
/* dynamic linking with shl_load (HP-UX) (comments from gmodule) */
#ifdef HAVE_DL_H
#include <dl.h>
@ -351,7 +371,7 @@ shl_sym (handle, symbol)
{
lt_ptr_t address;
if (shl_findsym((shl_t) (handle->handle), symbol, TYPE_UNDEFINED,
if (shl_findsym((shl_t) (handle->handle), symbol, TYPE_UNDEFINED,
&address) != 0 || !(handle->handle) || !address) {
last_error = unknown_error;
return 0;
@ -361,11 +381,11 @@ shl_sym (handle, symbol)
static
lt_dltype_t
shl = { LT_DLTYPE_TOP, 0, shl_init, shl_exit,
shl = { LTDL_TYPE_TOP, 0, shl_init, shl_exit,
shl_open, shl_close, shl_sym };
#undef LT_DLTYPE_TOP
#define LT_DLTYPE_TOP &shl
#undef LTDL_TYPE_TOP
#define LTDL_TYPE_TOP &shl
#endif
@ -422,18 +442,18 @@ dld_sym (handle, symbol)
{
lt_ptr_t address = dld_get_func(symbol);
if (!address)
if (!address)
last_error = unknown_error;
return address;
}
static
lt_dltype_t
dld = { LT_DLTYPE_TOP, 0, dld_init, dld_exit,
dld = { LTDL_TYPE_TOP, 0, dld_init, dld_exit,
dld_open, dld_close, dld_sym };
#undef LT_DLTYPE_TOP
#define LT_DLTYPE_TOP &dld
#undef LTDL_TYPE_TOP
#define LTDL_TYPE_TOP &dld
#endif
@ -486,23 +506,21 @@ wll_sym (handle, symbol)
{
lt_ptr_t address = GetProcAddress(handle->handle, symbol);
if (!address)
if (!address)
last_error = unknown_error;
return address;
}
static
lt_dltype_t
wll = { LT_DLTYPE_TOP, 0, wll_init, wll_exit,
wll = { LTDL_TYPE_TOP, 0, wll_init, wll_exit,
wll_open, wll_close, wll_sym };
#undef LT_DLTYPE_TOP
#define LT_DLTYPE_TOP &wll
#undef LTDL_TYPE_TOP
#define LTDL_TYPE_TOP &wll
#endif
#if HAVE_DLPREOPEN
/* emulate dynamic linking using preloaded_symbols */
typedef struct lt_dlsymlists_t {
@ -518,7 +536,7 @@ presym_init ()
{
preloaded_symbols = 0;
if (default_preloaded_symbols)
return lt_dlpreopen(default_preloaded_symbols);
return lt_dlpreload(default_preloaded_symbols);
return 0;
}
@ -633,19 +651,18 @@ presym_sym (handle, symbol)
static
lt_dltype_t
presym = { LT_DLTYPE_TOP, 0, presym_init, presym_exit,
presym = { LTDL_TYPE_TOP, 0, presym_init, presym_exit,
presym_open, presym_close, presym_sym };
#undef LT_DLTYPE_TOP
#define LT_DLTYPE_TOP &presym
#undef LTDL_TYPE_TOP
#define LTDL_TYPE_TOP &presym
#endif
static lt_dlhandle handles;
static char usr_search_path[LTDL_SEARCHPATH_MAX];
static lt_dlhandle handles = 0;
static int initialized = 0;
static lt_dltype types = LT_DLTYPE_TOP;
#undef LT_DLTYPE_TOP
static lt_dltype types = LTDL_TYPE_TOP;
#undef LTDL_TYPE_TOP
int
lt_dlinit ()
@ -659,6 +676,7 @@ lt_dlinit ()
return 0;
}
handles = 0;
usr_search_path[0] = '\0'; /* empty search path */
while (*type) {
if ((*type)->mod_init())
@ -678,35 +696,23 @@ lt_dlinit ()
}
int
lt_dlpreopen (preloaded)
lt_dlpreload (preloaded)
const lt_dlsymlist *preloaded;
{
#if HAVE_DLPREOPEN
if (preloaded)
return presym_add_symlist(preloaded);
else {
presym_free_symlists();
if (default_preloaded_symbols)
return lt_dlpreopen(default_preloaded_symbols);
return 0;
}
#else
last_error = dlpreopen_not_supported_error;
return 1;
#endif
presym_free_symlists();
if (default_preloaded_symbols)
return lt_dlpreload(default_preloaded_symbols);
return 0;
}
int
lt_dlpreopen_default_ (preloaded)
lt_dlpreload_default (preloaded)
const lt_dlsymlist *preloaded;
{
#if HAVE_DLPREOPEN
default_preloaded_symbols = preloaded;
return 0;
#else
last_error = dlpreopen_not_supported_error;
return 1;
#endif
}
int
@ -792,11 +798,6 @@ tryall_dlopen (handle, filename)
return 0;
}
/* max. filename length */
#ifndef FILENAME_MAX
#define FILENAME_MAX 1024
#endif
static int
find_module (handle, dir, libdir, dlname, old_name)
lt_dlhandle *handle;
@ -805,7 +806,7 @@ find_module (handle, dir, libdir, dlname, old_name)
const char *dlname;
const char *old_name;
{
char fullname[FILENAME_MAX];
char filename[LTDL_FILENAME_MAX];
/* search for old library first; if it was dlpreopened, we
want the preopened version of it, even if a dlopenable
@ -815,26 +816,28 @@ find_module (handle, dir, libdir, dlname, old_name)
/* search a module */
if (*dlname) {
/* try to open the installed module */
if (strlen(libdir)+strlen(dlname)+1 < FILENAME_MAX) {
strcpy(fullname, libdir);
strcat(fullname, "/");
strcat(fullname, dlname);
if (tryall_dlopen(handle, fullname) == 0)
return 0;
}
/* try to open the not-installed module */
if (strlen(dir)+strlen(dlname)+6 < FILENAME_MAX) {
strcpy(fullname, dir);
strcat(fullname, ".libs/");
strcat(fullname, dlname);
if (tryall_dlopen(handle, fullname) == 0)
if (strlen(dir)+strlen(dlname)+6 < LTDL_FILENAME_MAX) {
/* FIXME: we assume that LTDL_OBJDIR is 6 character long */
strcpy(filename, dir);
strcat(filename, LTDL_OBJDIR "/");
strcat(filename, dlname);
if (tryall_dlopen(handle, filename) == 0)
return 0;
}
if (strlen(dir)+strlen(dlname) < FILENAME_MAX) {
strcpy(fullname, dir);
strcat(fullname, dlname);
if (tryall_dlopen(handle, fullname) == 0)
/* try to open the installed module */
if (strlen(libdir)+strlen(dlname)+1 < LTDL_FILENAME_MAX) {
strcpy(filename, libdir);
strcat(filename, "/");
strcat(filename, dlname);
if (tryall_dlopen(handle, filename) == 0)
return 0;
}
/* hmm, maybe it was moved to another directory */
if (strlen(dir)+strlen(dlname) < LTDL_FILENAME_MAX) {
strcpy(filename, dir);
strcat(filename, dlname);
if (tryall_dlopen(handle, filename) == 0)
return 0;
}
}
@ -843,110 +846,88 @@ find_module (handle, dir, libdir, dlname, old_name)
}
static int
find_library (handle, filename, have_dir, basename, search_path)
find_library (handle, basename, search_path)
lt_dlhandle *handle;
const char *filename;
int have_dir;
const char *basename;
const char *search_path;
{
char dir[FILENAME_MAX], fullname[FILENAME_MAX];
const char *p, *next;
char filename[LTDL_FILENAME_MAX];
const char *cur, *next;
if (have_dir || !search_path) {
if (!search_path || !strlen(search_path)) {
last_error = file_not_found_error;
return 1;
}
/* try other directories */
/* search_path is a colon-separated
list of search directories */
p = search_path;
while (p) {
next = strchr(p, ':');
cur = search_path;
while (cur) {
next = strchr(cur, ':');
if (next) {
if (next - p + 1 >= FILENAME_MAX) {
if (next - cur + 1 >= FILENAME_MAX) {
last_error = buffer_overflow_error;
return 1;
}
strncpy(dir, p, next - p);
dir[next - p] = '\0';
p = next+1;
strncpy(filename, cur, next - cur);
filename[next - cur] = '\0';
cur = next+1;
} else {
if (strlen(p)+1 >= FILENAME_MAX) {
if (strlen(cur)+1 >= FILENAME_MAX) {
last_error = buffer_overflow_error;
return 1;
}
strcpy(dir, p);
p = 0;
strcpy(filename, cur);
cur = 0;
}
if (!*dir)
if (!*filename)
continue;
strcat(dir, "/");
if (strlen(dir)+strlen(basename) < FILENAME_MAX) {
strcpy(fullname, dir);
strcat(fullname, basename);
if (tryall_dlopen(handle, fullname) == 0)
return 0;
strcat(filename, "/");
if (strlen(filename)+strlen(basename) < LTDL_FILENAME_MAX) {
strcat(filename, basename);
if (tryall_dlopen(handle, filename) == 0)
return 0;
}
}
last_error = file_not_found_error;
return 1;
}
#undef READTEXT_MODE
/* fopen() mode flags for reading a text file */
#ifdef _WIN32
#define READTEXT_MODE "rt"
#else
#define READTEXT_MODE "r"
#endif
static FILE *
find_file (filename, basename, have_dir, search_path)
const char *filename;
int have_dir;
find_file (basename, search_path)
const char *basename;
const char *search_path;
{
char dir[FILENAME_MAX], fullname[FILENAME_MAX];
const char *p, *next;
char filename[LTDL_FILENAME_MAX];
const char *cur, *next;
FILE *file;
if (have_dir || !search_path) {
if (!search_path || !strlen(search_path)) {
last_error = file_not_found_error;
return 0;
}
/* try other directories */
/* search_path is a colon-separated
list of search directories */
p = search_path;
while (p) {
next = strchr(p, ':');
cur = search_path;
while (cur) {
next = strchr(cur, ':');
if (next) {
if (next - p + 1 >= FILENAME_MAX) {
if (next - cur + 1 >= LTDL_FILENAME_MAX) {
last_error = buffer_overflow_error;
return 0;
}
strncpy(dir, p, next - p);
dir[next - p] = '\0';
p = next+1;
strncpy(filename, cur, next - cur);
filename[next - cur] = '\0';
cur = next+1;
} else {
if (strlen(p)+1 >= FILENAME_MAX) {
if (strlen(cur)+1 >= LTDL_FILENAME_MAX) {
last_error = buffer_overflow_error;
return 0;
}
strcpy(dir, p);
p = 0;
strcpy(filename, cur);
cur = 0;
}
if (!*dir)
if (!*filename)
continue;
strcat(dir, "/");
if (strlen(dir)+strlen(basename) < FILENAME_MAX) {
strcpy(fullname, dir);
strcat(fullname, basename);
file = fopen(fullname, READTEXT_MODE);
strcat(filename, "/");
if (strlen(filename)+strlen(basename) < LTDL_FILENAME_MAX) {
strcat(filename, basename);
file = fopen(filename, LTDL_READTEXT_MODE);
if (file)
return file;
}
@ -957,16 +938,18 @@ find_file (filename, basename, have_dir, search_path)
static int
load_deplibs(handle, deplibs)
lt_dlhandle *handle;
lt_dlhandle handle;
const char *deplibs;
{
/* FIXME: load deplibs */
handle->depcount = 0;
handle->deps = 0;
return 0;
}
static int
unload_deplibs(handle)
lt_dlhandle *handle;
lt_dlhandle handle;
{
/* FIXME: unload deplibs */
return 0;
@ -977,7 +960,7 @@ lt_dlopen (filename)
const char *filename;
{
lt_dlhandle handle;
char dir[FILENAME_MAX];
char dir[LTDL_FILENAME_MAX];
const char *basename, *ext, *search_path;
#ifdef LTDL_SHLIBPATH_VAR
const char *sys_search_path;
@ -1002,9 +985,9 @@ lt_dlopen (filename)
/* check whether we open a libtool module (.la extension) */
ext = strrchr(basename, '.');
if (ext && strcmp(ext, ".la") == 0) {
char dlname[FILENAME_MAX], old_name[FILENAME_MAX];
char libdir[FILENAME_MAX], deplibs[FILENAME_MAX];
char tmp[FILENAME_MAX];
char dlname[LTDL_FILENAME_MAX], old_name[LTDL_FILENAME_MAX];
char libdir[LTDL_FILENAME_MAX], deplibs[LTDL_FILENAME_MAX];
char tmp[LTDL_FILENAME_MAX];
char *name;
FILE *file;
int i;
@ -1012,7 +995,7 @@ lt_dlopen (filename)
dlname[0] = old_name[0] = libdir[0] = deplibs[0] = '\0';
/* extract the module name from the file name */
if (strlen(basename) >= FILENAME_MAX) {
if (strlen(basename) >= LTDL_FILENAME_MAX) {
last_error = buffer_overflow_error;
return 0;
}
@ -1027,39 +1010,23 @@ lt_dlopen (filename)
last_error = memory_error;
return 0;
}
file = fopen(filename, READTEXT_MODE);
if (!file)
file = find_file(filename, *dir, basename,
usr_search_path);
if (!file)
file = find_file(filename, *dir, basename,
search_path);
file = fopen(filename, LTDL_READTEXT_MODE);
if (!file && !*dir) {
/* try other directories */
file = find_file(basename, usr_search_path);
if (!file)
file = find_file(basename, search_path);
#ifdef LTDL_SHLIBPATH_VAR
if (!file)
file = find_file(filename, *dir, basename,
sys_search_path);
if (!file)
file = find_file(basename, sys_search_path);
#endif
}
if (!file) {
free(name);
handle = (lt_dlhandle)0;
#ifdef LTDL_SHLIB_EXT
/* Try with the shared library extension */
name = malloc(strlen(filename) -
3 /*i.e., strlen(".la") */
+ strlen(LTDL_SHLIB_EXT)
+ 1 /* '\0' */);
if (name) {
strcpy(name, filename);
strcpy(name + strlen(filename) - 3,
LTDL_SHLIB_EXT);
handle = lt_dlopen(name);
free(name);
}
#endif
return handle;
return 0;
}
while (!feof(file)) {
if (!fgets(tmp, FILENAME_MAX, file))
if (!fgets(tmp, LTDL_FILENAME_MAX, file))
break;
if (strncmp(tmp, "dlname=", 7) == 0)
trim(dlname, &tmp[7]);
@ -1100,14 +1067,11 @@ lt_dlopen (filename)
last_error = memory_error;
return 0;
}
if (tryall_dlopen(&handle, filename)
&& find_library(&handle, filename, *dir,
basename, usr_search_path)
&& find_library(&handle, filename, *dir,
basename, search_path)
if (tryall_dlopen(&handle, filename) && !*dir
&& find_library(&handle, basename, usr_search_path)
&& find_library(&handle, basename, search_path)
#ifdef LTDL_SHLIBPATH_VAR
&& find_library(&handle, filename, *dir,
basename, sys_search_path)
&& find_library(&handle, basename, sys_search_path)
#endif
) {
free(handle);
@ -1157,21 +1121,13 @@ lt_dlclose (handle)
return 0;
}
#undef LT_SYMBOL_LENGTH
/* This is the maximum symbol size that won't require malloc/free */
#define LT_SYMBOL_LENGTH 256
#undef LT_SYMBOL_OVERHEAD
/* This accounts for the _LTX_ separator and the string terminator */
#define LT_SYMBOL_OVERHEAD 7
lt_ptr_t
lt_dlsym (handle, symbol)
lt_dlhandle handle;
const char *symbol;
{
int lensym;
char lsym[LT_SYMBOL_LENGTH];
char lsym[LTDL_SYMBOL_LENGTH];
char *sym;
lt_ptr_t address;
@ -1188,10 +1144,10 @@ lt_dlsym (handle, symbol)
lensym += strlen(handle->type->sym_prefix);
if (handle->name)
lensym += strlen(handle->name);
if (lensym + LT_SYMBOL_OVERHEAD < LT_SYMBOL_LENGTH)
if (lensym + LTDL_SYMBOL_OVERHEAD < LTDL_SYMBOL_LENGTH)
sym = lsym;
else
sym = malloc(lensym + LT_SYMBOL_OVERHEAD);
sym = malloc(lensym + LTDL_SYMBOL_OVERHEAD);
if (!sym) {
last_error = buffer_overflow_error;
return 0;
@ -1201,7 +1157,7 @@ lt_dlsym (handle, symbol)
if (handle->type->sym_prefix) {
strcpy(sym, handle->type->sym_prefix);
strcat(sym, handle->name);
} else
} else
strcpy(sym, handle->name);
strcat(sym, "_LTX_");
strcat(sym, symbol);
@ -1217,7 +1173,7 @@ lt_dlsym (handle, symbol)
if (handle->type->sym_prefix) {
strcpy(sym, handle->type->sym_prefix);
strcat(sym, symbol);
} else
} else
strcpy(sym, symbol);
address = handle->type->find_sym(handle, sym);
if (sym != lsym)
@ -1234,12 +1190,47 @@ lt_dlerror ()
return error;
}
const char *
lt_dlsearchpath (search_path)
int
lt_dladdsearchdir (search_dir)
const char *search_dir;
{
if (!search_dir) {
usr_search_path[0] = '\0'; /* reset the search path */
return 0;
}
if (!strlen(search_dir))
return 0;
if (strlen(usr_search_path) + strlen(search_dir) + 1
>= LTDL_SEARCHPATH_MAX) {
last_error = buffer_overflow_error;
return 1;
}
if (usr_search_path[0] != '\0')
strcat(usr_search_path, ":");
strcat(usr_search_path, search_dir);
return 0;
}
int
lt_dlsetsearchpath (search_path)
const char *search_path;
{
const char *old_path = usr_search_path;
usr_search_path = search_path;
return old_path;
if (!search_path) {
usr_search_path[0] = '\0'; /* reset the search path */
return 0;
}
if (!strlen(search_path))
return 0;
if (strlen(search_path) >= LTDL_SEARCHPATH_MAX) {
last_error = buffer_overflow_error;
return 1;
}
strcpy(usr_search_path, search_path);
return 0;
}
const char *
lt_dlgetsearchpath (void)
{
return usr_search_path;
}

View File

@ -75,17 +75,20 @@ typedef struct {
__BEGIN_DECLS
_LTDLL_EXTERN int lt_dlinit __P((void));
_LTDLL_EXTERN int lt_dlpreopen __P((const lt_dlsymlist *preloaded));
_LTDLL_EXTERN int lt_dlpreopen_default_ __P((const lt_dlsymlist *preloaded));
_LTDLL_EXTERN int lt_dlpreload __P((const lt_dlsymlist *preloaded));
_LTDLL_EXTERN int lt_dlpreload_default __P((const lt_dlsymlist *preloaded));
_LTDLL_EXTERN int lt_dlexit __P((void));
_LTDLL_EXTERN lt_dlhandle lt_dlopen __P((const char *filename));
_LTDLL_EXTERN int lt_dlclose __P((lt_dlhandle handle));
_LTDLL_EXTERN lt_ptr_t lt_dlsym __P((lt_dlhandle handle, const char *name));
_LTDLL_EXTERN const char *lt_dlerror __P((void));
_LTDLL_EXTERN const char *lt_dlsearchpath __P((const char *search_path));
_LTDLL_EXTERN int lt_dladdsearchdir __P((const char *search_dir));
_LTDLL_EXTERN int lt_dlsetsearchpath __P((const char *search_path));
_LTDLL_EXTERN const char *lt_dlgetsearchpath __P((void));
#define LTDL_PRELOADED_SYMBOLS extern const lt_dlsymlist lt_preloaded_symbols[];
#define LTDL_SET_PRELOADED_SYMBOLS() lt_dlpreload_default(lt_preloaded_symbols)
extern const lt_dlsymlist lt_preloaded_symbols[];
#define lt_dlpreopen_default() lt_dlpreopen_default_(lt_preloaded_symbols)
__END_DECLS
#endif /* !_LTDL_H_ */

78
libtool.m4 vendored
View File

@ -202,15 +202,15 @@ changequote(,)dnl
sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%'
changequote([,])dnl
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
case "$host_os" in
cygwin*)
# Convert to a UNC path for cygwin
test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"`
# Convert to a UNC path for cygwin
test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"`
;;
*)
test -z "$LD" && LD="$ac_prog"
test -z "$LD" && LD="$ac_prog"
;;
esac
;;
@ -226,15 +226,15 @@ changequote(,)dnl
changequote([,])dnl
sub_uncdir='s%\\%/%g'
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"`
ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"`
done
case "$host_os" in
cygwin*)
# Convert to a UNC path for cygwin
test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"`
# Convert to a UNC path for cygwin
test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"`
;;
*)
test -z "$LD" && LD="$ac_prog"
test -z "$LD" && LD="$ac_prog"
;;
esac
;;
@ -265,7 +265,7 @@ AC_CACHE_VAL(ac_cv_path_LD,
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
test "$with_gnu_ld" != yes && break
fi
fi
done
@ -310,13 +310,13 @@ else
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
ac_cv_path_NM="$ac_dir/nm -p"
break
else
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
@ -407,28 +407,28 @@ EOF
# Try sorting and uniquifying the output.
if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
mv -f "$ac_nlist"T "$ac_nlist"
ac_wcout=`wc "$ac_nlist" 2>/dev/null`
mv -f "$ac_nlist"T "$ac_nlist"
ac_wcout=`wc "$ac_nlist" 2>/dev/null`
changequote(,)dnl
ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
changequote([,])dnl
(test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
(test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
else
rm -f "$ac_nlist"T
ac_count=-1
rm -f "$ac_nlist"T
ac_count=-1
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
#endif
EOF
# Now generate the symbol file.
sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
# Now generate the symbol file.
sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
@ -450,8 +450,8 @@ dld_preloaded_symbols[] =
changequote([,])dnl
{
EOF
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
cat <<\EOF >> conftest.c
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
cat <<\EOF >> conftest.c
{0, (lt_ptr_t) 0}
};
@ -459,25 +459,25 @@ EOF
}
#endif
EOF
# Now try linking the two files.
mv conftest.$ac_objext conftestm.$ac_objext
# Now try linking the two files.
mv conftest.$ac_objext conftestm.$ac_objext
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="conftestm.$ac_objext"
LIBS="conftestm.$ac_objext"
CFLAGS="$CFLAGS$no_builtin_flag"
if AC_TRY_EVAL(ac_link) && test -s conftest; then
ac_pipe_works=yes
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
LIBS="$ac_save_LIBS"
if AC_TRY_EVAL(ac_link) && test -s conftest; then
ac_pipe_works=yes
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
LIBS="$ac_save_LIBS"
CFLAGS="$ac_save_CFLAGS"
else
echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
@ -536,9 +536,9 @@ if AC_TRY_EVAL(ac_compile); then
ac_cv_sys_symbol_underscore=yes
else
if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
:
:
else
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
fi
else

View File

@ -140,8 +140,8 @@ if test ! -f configure.in; then
fi
if (cd $pkgdatadir && ls); then :
else
files=`cd $pkgdatadir && ls`
if test -z "$files"; then
echo "$progname: cannot list files in \`$pkgdatadir'" 1>&2
exit 1
fi
@ -212,7 +212,7 @@ if test -z "$automake"; then
test -z "$localserial" && localserial=0
if test "$localserial" -lt "$instserial"; then
echo "You should $updatemsg."
echo "You should $updatemsg."
elif test "$localserial" -gt "$instserial"; then
echo "$progname: \`$libtool_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
if test -z "$force"; then
@ -250,6 +250,14 @@ for file in $files; do
fi
done
if test "x$ltdl" = xyes; then
if tar xzf $pkgdatadir/libltdl.tar.gz; then :
else
echo "$progname: cannot unpack libltdl.tar.gz" 1>&2
status=1
fi
fi
exit $status
# Local Variables:

View File

@ -1136,7 +1136,7 @@ else
if test "$with_gcc" = yes; then
# collect2 in egcs and probably latest gcc has full support for
# -shared flag, so we feel much better.
archive_cmds='$CC -shared $thread_safe_flags -o $objdir/$soname $libobjs $deplibs'
archive_cmds='$CC -shared -o $objdir/$soname $libobjs $deplibs'
else
archive_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp else cat $export_symbols > $lib.exp~
$CC -o $objdir/$soname $libobjs $deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry'
@ -1469,14 +1469,14 @@ EOF
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
mv -f "$nlist"T "$nlist"
else
rm -f "$nlist"T
rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$nlist" >/dev/null; then
if egrep ' nm_test_func$' "$nlist" >/dev/null; then
if egrep ' nm_test_func$' "$nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
@ -1523,11 +1523,11 @@ EOF
cat conftest.c >&5
fi
LIBS="$save_LIBS"
else
else
echo "cannot find nm_test_func in $nlist" >&5
fi
fi
else
echo "cannot find nm_test_var in $nlist" >&5
echo "cannot find nm_test_var in $nlist" >&5
fi
else
echo "cannot run $global_symbol_pipe" >&5
@ -1591,9 +1591,9 @@ finish_eval=
shlibpath_var=
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_search_path="/lib /usr/lib /usr/local/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
file_magic_command=
deplibs_check_method='unkwnon'
deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
# 'none' -- dependencies not supported.
@ -1722,7 +1722,7 @@ linux-gnu*)
shlibpath_var=LD_LIBRARY_PATH
deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
file_magic_command=file
sys_lib_search_path="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
if test -f /lib/ld.so.1; then
dynamic_linker='GNU ld.so'
@ -1790,7 +1790,7 @@ solaris*)
postinstall_cmds='chmod +x $lib'
deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
file_magic_command="file"
sys_lib_search_path="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib `echo $LD_LIBRARY_PATH | sed -e 's/:/ /g'`"
;;
sunos4*)
@ -1896,7 +1896,7 @@ case "$ltmain" in
old_postuninstall_cmds archive_cmds archive_sym_cmds postinstall_cmds postuninstall_cmds \
file_magic_command deplibs_check_method allow_undefined_flag no_undefined_flag \
finish_cmds finish_eval global_symbol_pipe \
hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path \
hardcode_libdir_flag_spec hardcode_libdir_separator sys_lib_search_path_spec \
compiler_c_o compiler_o_lo need_locks; do
case "$var" in
@ -1904,7 +1904,7 @@ case "$ltmain" in
old_postinstall_cmds | old_postuninstall_cmds | \
archive_cmds | archive_sym_cmds | \
postinstall_cmds | postuninstall_cmds | \
finish_cmds | sys_lib_search_path)
finish_cmds | sys_lib_search_path_spec)
# Double-quote double-evaled strings.
eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`\\\""
;;
@ -2159,7 +2159,7 @@ hardcode_minus_L=$hardcode_minus_L
hardcode_shlibpath_var=$hardcode_shlibpath_var
# System search path for libraries
sys_lib_search_path=$sys_lib_search_path
sys_lib_search_path_spec=$sys_lib_search_path_spec
# Fix the shell variable \$srcfile for the compiler.
fix_srcfile_path="$fix_srcfile_path"

View File

@ -584,13 +584,13 @@ compiler."
# #include <windows.h>
# #undef WIN32_LEAN_AND_MEAN
# #include <stdio.h>
#
#
# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
#
#
# #include <cygwin/cygwin_dll.h>
# DECLARE_CYGWIN_DLL( DllMain );
# HINSTANCE __hDllInstance_base;
#
#
# BOOL APIENTRY
# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
# {
@ -611,9 +611,9 @@ compiler."
convenience=
old_convenience=
deplibs=
eval lib_search_path=\"$sys_lib_search_path\"
eval lib_search_path=\"$sys_lib_search_path_spec\"
avoid_versioning=no
avoid_version=no
dlfiles=
dlprefiles=
dlpredeps=
@ -733,8 +733,8 @@ compiler."
continue
;;
-avoid-versioning)
avoid_versioning=yes
-avoid-version)
avoid_version=yes
continue
;;
@ -840,7 +840,7 @@ compiler."
;;
-R*)
xrpath="$xrpath "`echo "X$arg" | $Xsed -e 's/^-R//'`
xrpath="$xrpath "`echo "X$arg" | $Xsed -e 's/^-R//'`
continue
;;
@ -1231,7 +1231,7 @@ compiler."
*.la)
# Make sure we only generate libraries of the form `libNAME.la'.
case "$outputname" in
lib*)
lib*)
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
eval libname=\"$libname_spec\"
;;
@ -1252,8 +1252,8 @@ compiler."
esac
if test -n "$xrpath"; then
temp_xrpath=
for libdir in $xrpath; do
temp_xrpath=
for libdir in $xrpath; do
temp_xrpath="$temp_xrpath -R$libdir"
done
deplibs="$temp_xrpath $deplibs"
@ -1434,7 +1434,7 @@ compiler."
fi
# Remove version info from name if versioning should be avoided
if test "$avoid_versioning" = yes && test "$need_version" = no; then
if test "$avoid_version" = yes && test "$need_version" = no; then
major=
versuffix=
verstring=""
@ -1504,8 +1504,8 @@ compiler."
major=""
newdeplibs=
case "$deplibs_check_method" in
pass_all)
newdeplibs=$deplibs
pass_all)
newdeplibs=$deplibs
;; # Don't check for shared/static. Everything works.
# This might be a little naive. We might want to check
# whether the library exists or not. But this is on
@ -3130,6 +3130,7 @@ Compile a source file into a libtool library object.
This mode accepts the following additional options:
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
-static always build a \`.o' file suitable for static linking
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
@ -3198,7 +3199,7 @@ a program from several object files.
The following components of LINK-COMMAND are treated specially:
-all-static do not do any dynamic linking at all
-avoid-versioning do not add a version suffix if possible
-avoid-version do not add a version suffix if possible
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)

View File

@ -9,7 +9,7 @@ EXTRA_DIST = acinclude.m4
lib_LTLIBRARIES = foo1.la libfoo2.la
foo1_la_SOURCES = foo1.c
foo1_la_LDFLAGS = $(LIBADD_M) -module -avoid-versioning
foo1_la_LDFLAGS = $(LIBADD_M) -module -avoid-version
libfoo2_la_SOURCES = foo2.c
libfoo2_la_LDFLAGS = $(LIBADD_M) -module

View File

@ -22,6 +22,9 @@ USA. */
#include "ltdl.h"
#include <stdio.h>
/* the dlpreopened modules */
LTDL_PRELOADED_SYMBOLS;
int
test_dl (char *filename)
{
@ -88,14 +91,11 @@ main (int argc, char **argv)
fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
}
LTDL_SET_PRELOADED_SYMBOLS();
if (lt_dlinit() != 0) {
fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
return 1;
}
if (lt_dlpreopen(lt_preloaded_symbols) != 0) {
fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
return 1;
}
for (i = 1; i < argc; i++)
if (test_dl(argv[i]))