? cxxdemo ? patches ? libltdl/ltdl.h.new ? libltdl/ltdl.c.new ? libltdl/ltdl-beos.c ? libltdl/ltdl-dl.c ? libltdl/ltdl-dld.c ? libltdl/ltdl-preload.c ? libltdl/ltdl-shl.c ? libltdl/ltdl-windows.c Index: ChangeLog =================================================================== RCS file: /home/cvs/libtool/ChangeLog,v retrieving revision 1.824 diff -u -p -r1.824 ChangeLog --- ChangeLog 2000/11/21 08:53:33 1.824 +++ ChangeLog 2000/11/25 03:46:03 @@ -1,3 +1,10 @@ +2000-11-25 Gary V. Vaughan + + * libltdl/ltdl.c (lt_dlopen): Change the default search order + for modules. If the named module has no directory component, + always start the search with the user_search_path directories, + and then fall back on the current directory only if that fails. + 2000-11-20 Gary V. Vaughan * libltdl/Makefile.am (libltdl_la_LDFLAGS): increment the version Index: libltdl/ltdl.c =================================================================== RCS file: /home/cvs/libtool/libltdl/ltdl.c,v retrieving revision 1.113 diff -u -p -r1.113 ltdl.c --- libltdl/ltdl.c 2000/11/19 01:23:17 1.113 +++ libltdl/ltdl.c 2000/11/25 03:46:28 @@ -1696,6 +1696,7 @@ lt_dlopen (filename) const char *saved_error = last_error; char *canonical = 0, *basename = 0, *dir = 0, *name = 0; + /* dlopen self? */ if (!filename) { handle = (lt_dlhandle) lt_dlmalloc (sizeof (struct lt_dlhandle)); @@ -1729,6 +1730,8 @@ lt_dlopen (filename) return 0; } + /* If the canonical module name is a path (relative or absolute) + then split it into a directory part and a name part. */ basename = strrchr (canonical, '/'); if (basename) { @@ -1790,15 +1793,12 @@ lt_dlopen (filename) name[ext - basename] = '\0'; - /* now try to open the .la file */ - file = fopen (filename, LT_READTEXT_MODE); - if (!file) - { - last_error = LT_DLSTRERROR (FILE_NOT_FOUND); - } - if (!file && !dir) + /* Now try to open the .la file. If there is no directory name + component, try to find it first in user_search_path and then other + prescribed paths. Otherwise (or in any case if the module was not + yet found) try opening just the module name as passed. */ + if (!dir) { - /* try other directories */ file = (FILE*) find_file(basename, user_search_path, &dir, 0); if (!file) { @@ -1820,6 +1820,14 @@ lt_dlopen (filename) } #endif } + if (!file) + { + file = fopen (filename, LT_READTEXT_MODE); + } + if (!file) + { + last_error = LT_DLSTRERROR (FILE_NOT_FOUND); + } if (!file) { @@ -1974,8 +1982,11 @@ lt_dlopen (filename) handle->deplibs = 0; newhandle = handle; - if (tryall_dlopen (&newhandle, filename) - && (dir || (!find_file (basename, user_search_path, 0, &newhandle) + /* If the module has no directory name component, try to find it + first in user_search_path and then other prescribed paths. + Otherwise (or in any case if the module was not yet found) try + opening just the module name as passed. */ + if ((dir || (!find_file (basename, user_search_path, 0, &newhandle) && !find_file (basename, getenv ("LTDL_LIBRARY_PATH"), 0, &newhandle) #ifdef LTDL_SHLIBPATH_VAR @@ -1985,7 +1996,7 @@ lt_dlopen (filename) #ifdef LTDL_SYSSEARCHPATH && !find_file (basename, sys_search_path, 0, &newhandle) #endif - ))) + )) && tryall_dlopen (&newhandle, filename)) { lt_dlfree (handle); handle = 0;