From: Gary V. Vaughan Date: Tue, 18 Nov 2003 22:39:39 +0000 (+0000) Subject: * libltdl/ltdl.c (lt_dlhandle_find): New function to find a handle X-Git-Tag: release-1-9b~243 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b5a0f038d792af096ba4c2ada103abe12e6adc4;p=thirdparty%2Flibtool.git * libltdl/ltdl.c (lt_dlhandle_find): New function to find a handle by module name. * libltdl/ltdl.h (lt_dlhandle_find): Declare it. * doc/libtool.texi (User defined module data): Document it. * NEWS: Updated. --- diff --git a/ChangeLog b/ChangeLog index c011d95ec..d78f63670 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-11-18 Gary V. Vaughan + + * libltdl/ltdl.c (lt_dlhandle_find): New function to find a handle + by module name. + * libltdl/ltdl.h (lt_dlhandle_find): Declare it. + * doc/libtool.texi (User defined module data): Document it. + * NEWS: Updated. + 2003-11-17 Gary V. Vaughan * m4/libtool.m4 (AC_LIBTOOL_SETUP): Uncomment call to diff --git a/NEWS b/NEWS index edf2ea522..67dc329ec 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ New in 1.5b: 2003-??-??; CVS version 1.5a, Libtool team: * Mode inferrence removed, shorthand for choosing modes added. * Specifying -allow-undefined is now an error. * Speed up max_cmd_len check. +* New function in libltdl: lt_dlhandle_find provides access to module handles + by module name. * make install now deletes preexisting $prefix/share/libtool before installing latest files. * Extracting symbols from an import library on cygwin and win32 now works. diff --git a/doc/libtool.texi b/doc/libtool.texi index 5b9cca698..fbc585ce9 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -3199,6 +3199,12 @@ If @var{place} is the last element in the list of loaded modules, this function returns @code{NULL}. @end deftypefun +@deftypefun lt_dlhandle lt_dlhandle_find (@w{const char *@var{module_name}}) +Search through the loaded module handles for a module named +@var{module_name}, returning its handle if found or else @code{NULL} +if no such named module has been loaded. +@end deftypefun + Of course, you would still need to maintain your own list of loaded module handles to parallel the list maintained by libltdl if there are any other data that you need to associate with each handle for the diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index d1bf70624..4e992c581 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -4130,6 +4130,25 @@ lt_dlhandle_next (place) return place ? place->next : handles; } +lt_dlhandle +lt_dlhandle_find (module_name) + const char *module_name; +{ + lt_dlhandle cur = handles; + + if (cur) + { + do + { + if (cur->info.name && strcmp (cur->info.name, module_name) == 0) + break; + } + while ((cur = cur->next)); + } + + return cur; +} + int lt_dlforeach (func, data) int (*func) LT_PARAMS((lt_dlhandle handle, lt_ptr data)); diff --git a/libltdl/ltdl.h b/libltdl/ltdl.h index f9b2c44bc..0f1e13348 100644 --- a/libltdl/ltdl.h +++ b/libltdl/ltdl.h @@ -242,6 +242,8 @@ typedef struct { LT_SCOPE const lt_dlinfo *lt_dlgetinfo LT_PARAMS((lt_dlhandle handle)); LT_SCOPE lt_dlhandle lt_dlhandle_next LT_PARAMS((lt_dlhandle place)); +LT_SCOPE lt_dlhandle lt_dlhandle_find LT_PARAMS(( + const char *module_name)); LT_SCOPE int lt_dlforeach LT_PARAMS(( int (*func) (lt_dlhandle handle, lt_ptr data), lt_ptr data));