mirror of
git://git.savannah.gnu.org/libtool.git
synced 2024-11-21 01:40:57 +08:00
* libltdl/ltdl.h (lt_dlinfo): Move private module field to here...
* libltdl/ltdl.c (lt_dlhandle_struct): ...from here. Changed all callers. * libltdl/loader-loadlibrary.c (sys_wll_open): Use new inteface to scan loaded handle->info.module fields for previously loaded modules. * doc/libtool.texi (User defined module data): Document changes to the interface. * NEWS: Updated. Reported by Chuck Wilson <cwilson@ece.gatech.edu>
This commit is contained in:
parent
ae045aaf74
commit
8bd0890c7b
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2004-07-08 Gary V. Vaughan <gary@gnu.org>
|
||||
|
||||
* libltdl/ltdl.h (lt_dlinfo): Move private module field to here...
|
||||
* libltdl/ltdl.c (lt_dlhandle_struct): ...from here. Changed all
|
||||
callers.
|
||||
* libltdl/loader-loadlibrary.c (sys_wll_open): Use new inteface to
|
||||
scan loaded handle->info.module fields for previously loaded
|
||||
modules.
|
||||
* doc/libtool.texi (User defined module data): Document changes to
|
||||
the interface.
|
||||
* NEWS: Updated.
|
||||
Reported by Chuck Wilson <cwilson@ece.gatech.edu>
|
||||
|
||||
2004-07-07 Brad <brad@comstyle.com>
|
||||
|
||||
* m4/libtool.m4: Fixes for the OpenBSD support
|
||||
|
1
NEWS
1
NEWS
@ -46,6 +46,7 @@ New in 1.5b: 2004-??-??; CVS version 1.5a, Libtool team:
|
||||
The symbols are deprecated but exported for backwards compatibility.
|
||||
* libltdl no longer uses lt_dlmalloc, lt_dlrealloc and lt_dlfree. The symbols
|
||||
are still exported for backwards compatibility.
|
||||
* The lt_dlinfo struct has a new module field that can be used by dlloaders.
|
||||
* libltdl no longer supports pre-c89 compilers. Some of the pre89 portability
|
||||
functions had compile time bugs in them anyway, so you guys can't have been
|
||||
using it :-)
|
||||
|
@ -3329,14 +3329,17 @@ Some of the internal information about each loaded module that is
|
||||
maintained by libltdl is available to the user, in the form of this
|
||||
structure:
|
||||
|
||||
@deftypefn {Type} {struct} lt_dlinfo @{ @w{char *@var{filename};} @w{char *@var{name};} @w{int @var{ref_count};} @}
|
||||
@deftypefn {Type} {struct} lt_dlinfo @{ @w{char *@var{filename};} @w{char *@var{name};} @w{int @var{ref_count};} @w{lt_module @var{module};}@}
|
||||
@code{lt_dlinfo} is used to store information about a module.
|
||||
The @var{filename} attribute is a null-terminated character string of
|
||||
the real module file name. If the module is a libtool module then
|
||||
@var{name} is its module name (e.g. @code{"libfoo"} for
|
||||
@code{"dir/libfoo.la"}), otherwise it is set to @code{NULL}. The
|
||||
@var{ref_count} attribute is a reference counter that describes how
|
||||
often the same module is currently loaded.
|
||||
often the same module is currently loaded. @var{module} is the
|
||||
dlloader's internal handle for the native module, and can be used, for
|
||||
example, by a loader to check whether @var{module} has already been
|
||||
loaded to save loading it again.
|
||||
@end deftypefn
|
||||
|
||||
The following function will return a pointer to libltdl's internal copy
|
||||
|
@ -38,7 +38,7 @@ static lt_dlhandle handles;
|
||||
static lt_module
|
||||
sys_wll_open (lt_user_data loader_data, const char *filename)
|
||||
{
|
||||
lt_dlhandle cur;
|
||||
lt_dlhandle cur = 0;
|
||||
lt_module module = 0;
|
||||
const char *errormsg = 0;
|
||||
char *searchname = 0;
|
||||
@ -92,21 +92,19 @@ sys_wll_open (lt_user_data loader_data, const char *filename)
|
||||
We check whether LoadLibrary is returning a handle to
|
||||
an already loaded module, and simulate failure if we
|
||||
find one. */
|
||||
cur = handles;
|
||||
while (cur)
|
||||
while (cur = lt_dlhandle_next (cur))
|
||||
{
|
||||
if (!cur->module)
|
||||
const lt_dlinfo *info = lt_dlgetinfo (cur);
|
||||
if (!info->module)
|
||||
{
|
||||
cur = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cur->module == module)
|
||||
if (info->module == module)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
if (cur || !module)
|
||||
|
@ -91,7 +91,6 @@ struct lt_dlhandle_struct {
|
||||
lt_dlinfo info;
|
||||
int depcount; /* number of dependencies */
|
||||
lt_dlhandle *deplibs; /* dependencies */
|
||||
lt_module module; /* system module handle */
|
||||
void * system; /* system specific data */
|
||||
lt_caller_data *caller_data; /* per caller associated data */
|
||||
int flags; /* various boolean stats */
|
||||
@ -404,9 +403,9 @@ tryall_dlopen (lt_dlhandle *handle, const char *filename)
|
||||
{
|
||||
lt_user_data data = loader->dlloader_data;
|
||||
|
||||
cur->module = loader->module_open (data, filename);
|
||||
cur->info.module = loader->module_open (data, filename);
|
||||
|
||||
if (cur->module != 0)
|
||||
if (cur->info.module != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -1712,7 +1711,7 @@ lt_dlclose (lt_dlhandle handle)
|
||||
handles = handle->next;
|
||||
}
|
||||
|
||||
errors += handle->loader->module_close (data, handle->module);
|
||||
errors += handle->loader->module_close (data, handle->info.module);
|
||||
errors += unload_deplibs(handle);
|
||||
|
||||
/* It is up to the callers to free the data itself. */
|
||||
@ -1795,7 +1794,7 @@ lt_dlsym (lt_dlhandle handle, const char *symbol)
|
||||
strcat(sym, symbol);
|
||||
|
||||
/* try "modulename_LTX_symbol" */
|
||||
address = handle->loader->find_sym (data, handle->module, sym);
|
||||
address = handle->loader->find_sym (data, handle->info.module, sym);
|
||||
if (address)
|
||||
{
|
||||
if (sym != lsym)
|
||||
@ -1818,7 +1817,7 @@ lt_dlsym (lt_dlhandle handle, const char *symbol)
|
||||
strcpy(sym, symbol);
|
||||
}
|
||||
|
||||
address = handle->loader->find_sym (data, handle->module, sym);
|
||||
address = handle->loader->find_sym (data, handle->info.module, sym);
|
||||
if (sym != lsym)
|
||||
{
|
||||
FREE (sym);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ltdl.h -- generic dlopen functions
|
||||
Copyright (C) 1998-2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2000, 2004 Free Software Foundation, Inc.
|
||||
Originally by Thomas Tanner <tanner@ffii.org>
|
||||
|
||||
NOTE: The canonical source of this file is maintained with the
|
||||
@ -32,6 +32,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
|
||||
#include <libltdl/lt_system.h>
|
||||
#include <libltdl/lt_error.h>
|
||||
#include <libltdl/lt_dlloader.h>
|
||||
|
||||
LT_BEGIN_C_DECLS
|
||||
|
||||
@ -101,10 +102,11 @@ LT_SCOPE int lt_dlpreload_default (const lt_dlsymlist *preloaded);
|
||||
|
||||
/* Read only information pertaining to a loaded module. */
|
||||
typedef struct {
|
||||
char *filename; /* file name */
|
||||
char *name; /* module name */
|
||||
int ref_count; /* number of times lt_dlopened minus
|
||||
char * filename; /* file name */
|
||||
char * name; /* module name */
|
||||
int ref_count; /* number of times lt_dlopened minus
|
||||
number of times lt_dlclosed. */
|
||||
lt_module module; /* system module handle */
|
||||
} lt_dlinfo;
|
||||
|
||||
LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle);
|
||||
|
Loading…
Reference in New Issue
Block a user