libtool/libltdl/lt_dlloader.c

213 lines
5.8 KiB
C
Raw Permalink Normal View History

Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
/* lt_dlloader.c -- dynamic library loader interface
* HACKING (Licensing Rules): Explain the various license texts used for files distributed with Libtool, and update license text to match. * Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO, bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc, libltdl/README, libltdl/argz.c, libltdl/argz_.h, libltdl/config/general.m4sh, libltdl/config/getopt.m4sh, libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh, libltdl/config/mkstamp, libltdl/configure.ac, libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c, libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4, libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4, libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in, Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at, tests/cdemo-conf.test, tests/cdemo-exec.test, tests/cdemo-make.test, tests/cdemo-shared.test, tests/cdemo-static.test, tests/cdemo-undef.test, tests/cdemo/Makefile.am, tests/cdemo/configure.ac, tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c, tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh, tests/demo-conf.test, tests/demo-deplibs.test, tests/demo-exec.test, tests/demo-hardcode.test, tests/demo-inst.test, tests/demo-make.test, tests/demo-nofast.test, tests/demo-noinst-link.test, tests/demo-nopic.test, tests/demo-pic.test, tests/demo-relink.test, tests/demo-shared.test, tests/demo-static.test, tests/demo-unst.test, tests/demo/Makefile.am, tests/demo/configure.ac, tests/demo/dlmain.c, tests/demo/foo.c, tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c, tests/demo/hello.c, tests/demo/main.c, tests/depdemo-conf.test, tests/depdemo-exec.test, tests/depdemo-inst.test, tests/depdemo-make.test, tests/depdemo-nofast.test, tests/depdemo-relink.test, tests/depdemo-shared.test, tests/depdemo-static.test, tests/depdemo-unst.test, tests/depdemo/Makefile.am, tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am, tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h, tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c, tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am, tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h, tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c, tests/depdemo/l4/l4.h, tests/depdemo/main.c, tests/depdemo/sysdep.h, tests/deplibs-ident.at, tests/destdir.at, tests/duplicate_conv.at, tests/duplicate_deps.at, tests/duplicate_members.at, tests/early-libtool.at, tests/export.at, tests/f77demo-conf.test, tests/f77demo-exec.test, tests/f77demo-make.test, tests/f77demo-shared.test, tests/f77demo-static.test, tests/f77demo/Makefile.am, tests/f77demo/configure.ac, tests/f77demo/cprogram.c, tests/f77demo/foo.h, tests/f77demo/fooc.c, tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test, tests/fcdemo-make.test, tests/fcdemo-shared.test, tests/fcdemo-static.test, tests/fcdemo/Makefile.am, tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c, tests/fcdemo/foo.h, tests/fcdemo/fooc.c, tests/inherited_flags.at, tests/libtoolize.at, tests/link-2.test, tests/link-order.at, tests/link-order2.at, tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test, tests/mdemo-dryrun.test, tests/mdemo-exec.test, tests/mdemo-inst.test, tests/mdemo-make.test, tests/mdemo-shared.test, tests/mdemo-static.test, tests/mdemo-unst.test, tests/mdemo/Makefile.am, tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c, tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c, tests/mdemo/sub.c, tests/mdemo2-conf.test, tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac, tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at, tests/objectlist.test, tests/old-m4-iface.at, tests/pdemo-conf.test, tests/pdemo-exec.test, tests/pdemo-inst.test, tests/pdemo-make.test, tests/pdemo/Makefile.am, tests/pdemo/configure.ac, tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c, tests/pdemo/longer_file_name_foo.c, tests/pdemo/longer_file_name_foo2.c, tests/pdemo/longer_file_name_hell1.c, tests/pdemo/longer_file_name_hell2.c, tests/pdemo/longer_file_name_hello.c, tests/pdemo/longer_file_name_main.c, tests/quote.test, tests/recursive.at, tests/search-path.at, tests/sh.test, tests/shlibpath.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/suffix.test, tests/tagdemo-conf.test, tests/tagdemo-exec.test, tests/tagdemo-make.test, tests/tagdemo-shared.test, tests/tagdemo-static.test, tests/tagdemo-undef.test, tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp, tests/tagdemo/baz.h, tests/tagdemo/configure.ac, tests/tagdemo/conv.cpp, tests/tagdemo/conv.h, tests/tagdemo/foo.cpp, tests/tagdemo/foo.h, tests/tagdemo/main.cpp, tests/tagtrace.test, tests/template.at, tests/testsuite.at: Apply correct license text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
Copyright (C) 2004, 2007-2008, 2011-2019, 2021-2024 Free Software
Foundation, Inc.
* HACKING (Licensing Rules): Explain the various license texts used for files distributed with Libtool, and update license text to match. * Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO, bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc, libltdl/README, libltdl/argz.c, libltdl/argz_.h, libltdl/config/general.m4sh, libltdl/config/getopt.m4sh, libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh, libltdl/config/mkstamp, libltdl/configure.ac, libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c, libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4, libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4, libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in, Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at, tests/cdemo-conf.test, tests/cdemo-exec.test, tests/cdemo-make.test, tests/cdemo-shared.test, tests/cdemo-static.test, tests/cdemo-undef.test, tests/cdemo/Makefile.am, tests/cdemo/configure.ac, tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c, tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh, tests/demo-conf.test, tests/demo-deplibs.test, tests/demo-exec.test, tests/demo-hardcode.test, tests/demo-inst.test, tests/demo-make.test, tests/demo-nofast.test, tests/demo-noinst-link.test, tests/demo-nopic.test, tests/demo-pic.test, tests/demo-relink.test, tests/demo-shared.test, tests/demo-static.test, tests/demo-unst.test, tests/demo/Makefile.am, tests/demo/configure.ac, tests/demo/dlmain.c, tests/demo/foo.c, tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c, tests/demo/hello.c, tests/demo/main.c, tests/depdemo-conf.test, tests/depdemo-exec.test, tests/depdemo-inst.test, tests/depdemo-make.test, tests/depdemo-nofast.test, tests/depdemo-relink.test, tests/depdemo-shared.test, tests/depdemo-static.test, tests/depdemo-unst.test, tests/depdemo/Makefile.am, tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am, tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h, tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c, tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am, tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h, tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c, tests/depdemo/l4/l4.h, tests/depdemo/main.c, tests/depdemo/sysdep.h, tests/deplibs-ident.at, tests/destdir.at, tests/duplicate_conv.at, tests/duplicate_deps.at, tests/duplicate_members.at, tests/early-libtool.at, tests/export.at, tests/f77demo-conf.test, tests/f77demo-exec.test, tests/f77demo-make.test, tests/f77demo-shared.test, tests/f77demo-static.test, tests/f77demo/Makefile.am, tests/f77demo/configure.ac, tests/f77demo/cprogram.c, tests/f77demo/foo.h, tests/f77demo/fooc.c, tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test, tests/fcdemo-make.test, tests/fcdemo-shared.test, tests/fcdemo-static.test, tests/fcdemo/Makefile.am, tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c, tests/fcdemo/foo.h, tests/fcdemo/fooc.c, tests/inherited_flags.at, tests/libtoolize.at, tests/link-2.test, tests/link-order.at, tests/link-order2.at, tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test, tests/mdemo-dryrun.test, tests/mdemo-exec.test, tests/mdemo-inst.test, tests/mdemo-make.test, tests/mdemo-shared.test, tests/mdemo-static.test, tests/mdemo-unst.test, tests/mdemo/Makefile.am, tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c, tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c, tests/mdemo/sub.c, tests/mdemo2-conf.test, tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac, tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at, tests/objectlist.test, tests/old-m4-iface.at, tests/pdemo-conf.test, tests/pdemo-exec.test, tests/pdemo-inst.test, tests/pdemo-make.test, tests/pdemo/Makefile.am, tests/pdemo/configure.ac, tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c, tests/pdemo/longer_file_name_foo.c, tests/pdemo/longer_file_name_foo2.c, tests/pdemo/longer_file_name_hell1.c, tests/pdemo/longer_file_name_hell2.c, tests/pdemo/longer_file_name_hello.c, tests/pdemo/longer_file_name_main.c, tests/quote.test, tests/recursive.at, tests/search-path.at, tests/sh.test, tests/shlibpath.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/suffix.test, tests/tagdemo-conf.test, tests/tagdemo-exec.test, tests/tagdemo-make.test, tests/tagdemo-shared.test, tests/tagdemo-static.test, tests/tagdemo-undef.test, tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp, tests/tagdemo/baz.h, tests/tagdemo/configure.ac, tests/tagdemo/conv.cpp, tests/tagdemo/conv.h, tests/tagdemo/foo.cpp, tests/tagdemo/foo.h, tests/tagdemo/main.cpp, tests/tagtrace.test, tests/template.at, tests/testsuite.at: Apply correct license text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
Written by Gary V. Vaughan, 2004
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
NOTE: The canonical source of this file is maintained with the
GNU Libtool package. Report bugs to bug-libtool@gnu.org.
* HACKING (Licensing Rules): Explain the various license texts used for files distributed with Libtool, and update license text to match. * Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO, bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc, libltdl/README, libltdl/argz.c, libltdl/argz_.h, libltdl/config/general.m4sh, libltdl/config/getopt.m4sh, libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh, libltdl/config/mkstamp, libltdl/configure.ac, libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c, libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4, libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4, libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in, Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at, tests/cdemo-conf.test, tests/cdemo-exec.test, tests/cdemo-make.test, tests/cdemo-shared.test, tests/cdemo-static.test, tests/cdemo-undef.test, tests/cdemo/Makefile.am, tests/cdemo/configure.ac, tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c, tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh, tests/demo-conf.test, tests/demo-deplibs.test, tests/demo-exec.test, tests/demo-hardcode.test, tests/demo-inst.test, tests/demo-make.test, tests/demo-nofast.test, tests/demo-noinst-link.test, tests/demo-nopic.test, tests/demo-pic.test, tests/demo-relink.test, tests/demo-shared.test, tests/demo-static.test, tests/demo-unst.test, tests/demo/Makefile.am, tests/demo/configure.ac, tests/demo/dlmain.c, tests/demo/foo.c, tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c, tests/demo/hello.c, tests/demo/main.c, tests/depdemo-conf.test, tests/depdemo-exec.test, tests/depdemo-inst.test, tests/depdemo-make.test, tests/depdemo-nofast.test, tests/depdemo-relink.test, tests/depdemo-shared.test, tests/depdemo-static.test, tests/depdemo-unst.test, tests/depdemo/Makefile.am, tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am, tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h, tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c, tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am, tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h, tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c, tests/depdemo/l4/l4.h, tests/depdemo/main.c, tests/depdemo/sysdep.h, tests/deplibs-ident.at, tests/destdir.at, tests/duplicate_conv.at, tests/duplicate_deps.at, tests/duplicate_members.at, tests/early-libtool.at, tests/export.at, tests/f77demo-conf.test, tests/f77demo-exec.test, tests/f77demo-make.test, tests/f77demo-shared.test, tests/f77demo-static.test, tests/f77demo/Makefile.am, tests/f77demo/configure.ac, tests/f77demo/cprogram.c, tests/f77demo/foo.h, tests/f77demo/fooc.c, tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test, tests/fcdemo-make.test, tests/fcdemo-shared.test, tests/fcdemo-static.test, tests/fcdemo/Makefile.am, tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c, tests/fcdemo/foo.h, tests/fcdemo/fooc.c, tests/inherited_flags.at, tests/libtoolize.at, tests/link-2.test, tests/link-order.at, tests/link-order2.at, tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test, tests/mdemo-dryrun.test, tests/mdemo-exec.test, tests/mdemo-inst.test, tests/mdemo-make.test, tests/mdemo-shared.test, tests/mdemo-static.test, tests/mdemo-unst.test, tests/mdemo/Makefile.am, tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c, tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c, tests/mdemo/sub.c, tests/mdemo2-conf.test, tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac, tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at, tests/objectlist.test, tests/old-m4-iface.at, tests/pdemo-conf.test, tests/pdemo-exec.test, tests/pdemo-inst.test, tests/pdemo-make.test, tests/pdemo/Makefile.am, tests/pdemo/configure.ac, tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c, tests/pdemo/longer_file_name_foo.c, tests/pdemo/longer_file_name_foo2.c, tests/pdemo/longer_file_name_hell1.c, tests/pdemo/longer_file_name_hell2.c, tests/pdemo/longer_file_name_hello.c, tests/pdemo/longer_file_name_main.c, tests/quote.test, tests/recursive.at, tests/search-path.at, tests/sh.test, tests/shlibpath.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/suffix.test, tests/tagdemo-conf.test, tests/tagdemo-exec.test, tests/tagdemo-make.test, tests/tagdemo-shared.test, tests/tagdemo-static.test, tests/tagdemo-undef.test, tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp, tests/tagdemo/baz.h, tests/tagdemo/configure.ac, tests/tagdemo/conv.cpp, tests/tagdemo/conv.h, tests/tagdemo/foo.cpp, tests/tagdemo/foo.h, tests/tagdemo/main.cpp, tests/tagtrace.test, tests/template.at, tests/testsuite.at: Apply correct license text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
GNU Libltdl is free software; you can redistribute it and/or
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
As a special exception to the GNU Lesser General Public License,
if you distribute this file as part of a program or library that
* HACKING (Licensing Rules): Explain the various license texts used for files distributed with Libtool, and update license text to match. * Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO, bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc, libltdl/README, libltdl/argz.c, libltdl/argz_.h, libltdl/config/general.m4sh, libltdl/config/getopt.m4sh, libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh, libltdl/config/mkstamp, libltdl/configure.ac, libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c, libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4, libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4, libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in, Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at, tests/cdemo-conf.test, tests/cdemo-exec.test, tests/cdemo-make.test, tests/cdemo-shared.test, tests/cdemo-static.test, tests/cdemo-undef.test, tests/cdemo/Makefile.am, tests/cdemo/configure.ac, tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c, tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh, tests/demo-conf.test, tests/demo-deplibs.test, tests/demo-exec.test, tests/demo-hardcode.test, tests/demo-inst.test, tests/demo-make.test, tests/demo-nofast.test, tests/demo-noinst-link.test, tests/demo-nopic.test, tests/demo-pic.test, tests/demo-relink.test, tests/demo-shared.test, tests/demo-static.test, tests/demo-unst.test, tests/demo/Makefile.am, tests/demo/configure.ac, tests/demo/dlmain.c, tests/demo/foo.c, tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c, tests/demo/hello.c, tests/demo/main.c, tests/depdemo-conf.test, tests/depdemo-exec.test, tests/depdemo-inst.test, tests/depdemo-make.test, tests/depdemo-nofast.test, tests/depdemo-relink.test, tests/depdemo-shared.test, tests/depdemo-static.test, tests/depdemo-unst.test, tests/depdemo/Makefile.am, tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am, tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h, tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c, tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am, tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h, tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c, tests/depdemo/l4/l4.h, tests/depdemo/main.c, tests/depdemo/sysdep.h, tests/deplibs-ident.at, tests/destdir.at, tests/duplicate_conv.at, tests/duplicate_deps.at, tests/duplicate_members.at, tests/early-libtool.at, tests/export.at, tests/f77demo-conf.test, tests/f77demo-exec.test, tests/f77demo-make.test, tests/f77demo-shared.test, tests/f77demo-static.test, tests/f77demo/Makefile.am, tests/f77demo/configure.ac, tests/f77demo/cprogram.c, tests/f77demo/foo.h, tests/f77demo/fooc.c, tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test, tests/fcdemo-make.test, tests/fcdemo-shared.test, tests/fcdemo-static.test, tests/fcdemo/Makefile.am, tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c, tests/fcdemo/foo.h, tests/fcdemo/fooc.c, tests/inherited_flags.at, tests/libtoolize.at, tests/link-2.test, tests/link-order.at, tests/link-order2.at, tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test, tests/mdemo-dryrun.test, tests/mdemo-exec.test, tests/mdemo-inst.test, tests/mdemo-make.test, tests/mdemo-shared.test, tests/mdemo-static.test, tests/mdemo-unst.test, tests/mdemo/Makefile.am, tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c, tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c, tests/mdemo/sub.c, tests/mdemo2-conf.test, tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac, tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at, tests/objectlist.test, tests/old-m4-iface.at, tests/pdemo-conf.test, tests/pdemo-exec.test, tests/pdemo-inst.test, tests/pdemo-make.test, tests/pdemo/Makefile.am, tests/pdemo/configure.ac, tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c, tests/pdemo/longer_file_name_foo.c, tests/pdemo/longer_file_name_foo2.c, tests/pdemo/longer_file_name_hell1.c, tests/pdemo/longer_file_name_hell2.c, tests/pdemo/longer_file_name_hello.c, tests/pdemo/longer_file_name_main.c, tests/quote.test, tests/recursive.at, tests/search-path.at, tests/sh.test, tests/shlibpath.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/suffix.test, tests/tagdemo-conf.test, tests/tagdemo-exec.test, tests/tagdemo-make.test, tests/tagdemo-shared.test, tests/tagdemo-static.test, tests/tagdemo-undef.test, tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp, tests/tagdemo/baz.h, tests/tagdemo/configure.ac, tests/tagdemo/conv.cpp, tests/tagdemo/conv.h, tests/tagdemo/foo.cpp, tests/tagdemo/foo.h, tests/tagdemo/main.cpp, tests/tagtrace.test, tests/template.at, tests/testsuite.at: Apply correct license text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
is built using GNU Libtool, you may include this file under the
same distribution terms that you use for the rest of that program.
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
* HACKING (Licensing Rules): Explain the various license texts used for files distributed with Libtool, and update license text to match. * Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO, bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc, libltdl/README, libltdl/argz.c, libltdl/argz_.h, libltdl/config/general.m4sh, libltdl/config/getopt.m4sh, libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh, libltdl/config/mkstamp, libltdl/configure.ac, libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c, libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4, libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4, libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in, Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at, tests/cdemo-conf.test, tests/cdemo-exec.test, tests/cdemo-make.test, tests/cdemo-shared.test, tests/cdemo-static.test, tests/cdemo-undef.test, tests/cdemo/Makefile.am, tests/cdemo/configure.ac, tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c, tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh, tests/demo-conf.test, tests/demo-deplibs.test, tests/demo-exec.test, tests/demo-hardcode.test, tests/demo-inst.test, tests/demo-make.test, tests/demo-nofast.test, tests/demo-noinst-link.test, tests/demo-nopic.test, tests/demo-pic.test, tests/demo-relink.test, tests/demo-shared.test, tests/demo-static.test, tests/demo-unst.test, tests/demo/Makefile.am, tests/demo/configure.ac, tests/demo/dlmain.c, tests/demo/foo.c, tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c, tests/demo/hello.c, tests/demo/main.c, tests/depdemo-conf.test, tests/depdemo-exec.test, tests/depdemo-inst.test, tests/depdemo-make.test, tests/depdemo-nofast.test, tests/depdemo-relink.test, tests/depdemo-shared.test, tests/depdemo-static.test, tests/depdemo-unst.test, tests/depdemo/Makefile.am, tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am, tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h, tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c, tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am, tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h, tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c, tests/depdemo/l4/l4.h, tests/depdemo/main.c, tests/depdemo/sysdep.h, tests/deplibs-ident.at, tests/destdir.at, tests/duplicate_conv.at, tests/duplicate_deps.at, tests/duplicate_members.at, tests/early-libtool.at, tests/export.at, tests/f77demo-conf.test, tests/f77demo-exec.test, tests/f77demo-make.test, tests/f77demo-shared.test, tests/f77demo-static.test, tests/f77demo/Makefile.am, tests/f77demo/configure.ac, tests/f77demo/cprogram.c, tests/f77demo/foo.h, tests/f77demo/fooc.c, tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test, tests/fcdemo-make.test, tests/fcdemo-shared.test, tests/fcdemo-static.test, tests/fcdemo/Makefile.am, tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c, tests/fcdemo/foo.h, tests/fcdemo/fooc.c, tests/inherited_flags.at, tests/libtoolize.at, tests/link-2.test, tests/link-order.at, tests/link-order2.at, tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test, tests/mdemo-dryrun.test, tests/mdemo-exec.test, tests/mdemo-inst.test, tests/mdemo-make.test, tests/mdemo-shared.test, tests/mdemo-static.test, tests/mdemo-unst.test, tests/mdemo/Makefile.am, tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c, tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c, tests/mdemo/sub.c, tests/mdemo2-conf.test, tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac, tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at, tests/objectlist.test, tests/old-m4-iface.at, tests/pdemo-conf.test, tests/pdemo-exec.test, tests/pdemo-inst.test, tests/pdemo-make.test, tests/pdemo/Makefile.am, tests/pdemo/configure.ac, tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c, tests/pdemo/longer_file_name_foo.c, tests/pdemo/longer_file_name_foo2.c, tests/pdemo/longer_file_name_hell1.c, tests/pdemo/longer_file_name_hell2.c, tests/pdemo/longer_file_name_hello.c, tests/pdemo/longer_file_name_main.c, tests/quote.test, tests/recursive.at, tests/search-path.at, tests/sh.test, tests/shlibpath.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/suffix.test, tests/tagdemo-conf.test, tests/tagdemo-exec.test, tests/tagdemo-make.test, tests/tagdemo-shared.test, tests/tagdemo-static.test, tests/tagdemo-undef.test, tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp, tests/tagdemo/baz.h, tests/tagdemo/configure.ac, tests/tagdemo/conv.cpp, tests/tagdemo/conv.h, tests/tagdemo/foo.cpp, tests/tagdemo/foo.h, tests/tagdemo/main.cpp, tests/tagtrace.test, tests/template.at, tests/testsuite.at: Apply correct license text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
GNU Libltdl is distributed in the hope that it will be useful,
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
* HACKING (Licensing Rules): Explain the various license texts used for files distributed with Libtool, and update license text to match. * Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO, bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc, libltdl/README, libltdl/argz.c, libltdl/argz_.h, libltdl/config/general.m4sh, libltdl/config/getopt.m4sh, libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh, libltdl/config/mkstamp, libltdl/configure.ac, libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c, libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4, libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4, libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in, Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at, tests/cdemo-conf.test, tests/cdemo-exec.test, tests/cdemo-make.test, tests/cdemo-shared.test, tests/cdemo-static.test, tests/cdemo-undef.test, tests/cdemo/Makefile.am, tests/cdemo/configure.ac, tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c, tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh, tests/demo-conf.test, tests/demo-deplibs.test, tests/demo-exec.test, tests/demo-hardcode.test, tests/demo-inst.test, tests/demo-make.test, tests/demo-nofast.test, tests/demo-noinst-link.test, tests/demo-nopic.test, tests/demo-pic.test, tests/demo-relink.test, tests/demo-shared.test, tests/demo-static.test, tests/demo-unst.test, tests/demo/Makefile.am, tests/demo/configure.ac, tests/demo/dlmain.c, tests/demo/foo.c, tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c, tests/demo/hello.c, tests/demo/main.c, tests/depdemo-conf.test, tests/depdemo-exec.test, tests/depdemo-inst.test, tests/depdemo-make.test, tests/depdemo-nofast.test, tests/depdemo-relink.test, tests/depdemo-shared.test, tests/depdemo-static.test, tests/depdemo-unst.test, tests/depdemo/Makefile.am, tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am, tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h, tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c, tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am, tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h, tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c, tests/depdemo/l4/l4.h, tests/depdemo/main.c, tests/depdemo/sysdep.h, tests/deplibs-ident.at, tests/destdir.at, tests/duplicate_conv.at, tests/duplicate_deps.at, tests/duplicate_members.at, tests/early-libtool.at, tests/export.at, tests/f77demo-conf.test, tests/f77demo-exec.test, tests/f77demo-make.test, tests/f77demo-shared.test, tests/f77demo-static.test, tests/f77demo/Makefile.am, tests/f77demo/configure.ac, tests/f77demo/cprogram.c, tests/f77demo/foo.h, tests/f77demo/fooc.c, tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test, tests/fcdemo-make.test, tests/fcdemo-shared.test, tests/fcdemo-static.test, tests/fcdemo/Makefile.am, tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c, tests/fcdemo/foo.h, tests/fcdemo/fooc.c, tests/inherited_flags.at, tests/libtoolize.at, tests/link-2.test, tests/link-order.at, tests/link-order2.at, tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test, tests/mdemo-dryrun.test, tests/mdemo-exec.test, tests/mdemo-inst.test, tests/mdemo-make.test, tests/mdemo-shared.test, tests/mdemo-static.test, tests/mdemo-unst.test, tests/mdemo/Makefile.am, tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c, tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c, tests/mdemo/sub.c, tests/mdemo2-conf.test, tests/mdemo2-exec.test, tests/mdemo2-make.test, tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac, tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at, tests/objectlist.test, tests/old-m4-iface.at, tests/pdemo-conf.test, tests/pdemo-exec.test, tests/pdemo-inst.test, tests/pdemo-make.test, tests/pdemo/Makefile.am, tests/pdemo/configure.ac, tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c, tests/pdemo/longer_file_name_foo.c, tests/pdemo/longer_file_name_foo2.c, tests/pdemo/longer_file_name_hell1.c, tests/pdemo/longer_file_name_hell2.c, tests/pdemo/longer_file_name_hello.c, tests/pdemo/longer_file_name_main.c, tests/quote.test, tests/recursive.at, tests/search-path.at, tests/sh.test, tests/shlibpath.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/suffix.test, tests/tagdemo-conf.test, tests/tagdemo-exec.test, tests/tagdemo-make.test, tests/tagdemo-shared.test, tests/tagdemo-static.test, tests/tagdemo-undef.test, tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp, tests/tagdemo/baz.h, tests/tagdemo/configure.ac, tests/tagdemo/conv.cpp, tests/tagdemo/conv.h, tests/tagdemo/foo.cpp, tests/tagdemo/foo.h, tests/tagdemo/main.cpp, tests/tagtrace.test, tests/template.at, tests/testsuite.at: Apply correct license text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
You should have received a copy of the GNU Lesser General Public
libtool: FSF office address replaced by URL * AUTHORS, HACKING, Makefile.am, bootstrap.conf, build-aux/edit-readme-alpha, build-aux/no-bogus-m4-defines, cfg.mk, configure.ac, libltdl/configure.ac, libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__argz_.h, libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c, libltdl/lt__alloc.c, libltdl/lt__argz.c, libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h, libltdl/ltdl.mk, libltdl/slist.c, tests/am-subdir.at, tests/archive-in-archive.at, tests/bindir.at, tests/bug_62343.at, tests/cdemo.at, tests/cmdline_wrap.at, tests/configure-funcs.at, tests/configure-iface.at, tests/convenience.at, tests/ctor.at, tests/cwrapper.at, tests/darwin.at, tests/demo.at, tests/depdemo.at, tests/deplib-in-subdir.at, tests/deplibs-ident.at, tests/deplibs-mingw.at, tests/destdir.at, tests/dlloader-api.at, tests/dumpbin-symbols.at, tests/duplicate_conv.at, tests/duplicate_deps.at, tests/duplicate_members.at, tests/early-libtool.at, tests/exceptions.at, tests/execute-mode.at, tests/exeext.at, tests/export-def.at, tests/export.at, tests/f77demo.at, tests/fail.at, tests/fcdemo.at, tests/flags.at, tests/help.at, tests/indirect_deps.at, tests/infer-tag.at, tests/inherited_flags.at, tests/install.at, tests/lalib-syntax.at, tests/libtool.at, tests/libtoolize.at, tests/link-order.at, tests/link-order2.at, tests/loadlibrary.at, tests/localization.at, tests/lt_dladvise.at, tests/lt_dlexit.at, tests/lt_dlopen.at, tests/lt_dlopen_a.at, tests/lt_dlopenext.at, tests/ltdl-api.at, tests/ltdl-libdir.at, tests/mdemo.at, tests/need_lib_prefix.at, tests/no-executables.at, tests/nocase.at, tests/nonrecursive.at, tests/old-m4-iface.at, tests/pic_flag.at, tests/recursive.at, tests/resident.at, tests/runpath-in-lalib.at, tests/search-path.at, tests/shlibpath.at, tests/slist.at, tests/standalone.at, tests/static.at, tests/stresstest.at, tests/subproject.at, tests/sysroot.at, tests/tagdemo.at, tests/template.at, tests/testsuite.at, tests/versioning.at, tests/with-pic.at: Replace FSF address in each file's license block with a URL that points to licenses online hosted by GNU.
2024-09-03 23:02:46 +08:00
License along with GNU Libltdl. If not, see <https://www.gnu.org/licenses/>.
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
*/
#include "lt__private.h"
#include "lt_dlloader.h"
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
#define RETURN_SUCCESS 0
#define RETURN_FAILURE 1
static void * loader_callback (SList *item, void *userdata);
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
/* A list of all the dlloaders we know about, each stored as a boxed
SList item: */
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
static SList *loaders = 0;
/* Return NULL, unless the loader in this ITEM has a matching name,
in which case we return the matching item so that its address is
passed back out (for possible freeing) by slist_remove. */
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
static void *
loader_callback (SList *item, void *userdata)
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
const lt_dlvtable *vtable = (const lt_dlvtable *) item->userdata;
const char * name = (const char *) userdata;
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
assert (vtable);
return STREQ (vtable->name, name) ? (void *) item : NULL;
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
}
/* Hook VTABLE into our global LOADERS list according to its own
PRIORITY field value. */
int
lt_dlloader_add (const lt_dlvtable *vtable)
{
SList *item;
if ((vtable == 0) /* diagnose invalid vtable fields */
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
|| (vtable->module_open == 0)
|| (vtable->module_close == 0)
|| (vtable->find_sym == 0)
|| ((vtable->priority != LT_DLLOADER_PREPEND) &&
(vtable->priority != LT_DLLOADER_APPEND)))
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
LT__SETERROR (INVALID_LOADER);
return RETURN_FAILURE;
}
item = slist_box (vtable);
if (!item)
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
(*lt__alloc_die) ();
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
/* Let the caller know something went wrong if lt__alloc_die
doesn't abort. */
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
return RETURN_FAILURE;
}
if (vtable->priority == LT_DLLOADER_PREPEND)
{
loaders = slist_cons (item, loaders);
}
else
{
assert (vtable->priority == LT_DLLOADER_APPEND);
loaders = slist_concat (loaders, item);
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
}
return RETURN_SUCCESS;
}
Add a test to simulate a failure visible on systems which need a library prefix like 'lib', such as BeOS. Fix a number of bugs exposed by this test in order for it to pass. Currently the prefix is hardcoded as 'lib', as I am not aware of systems that require a different prefix: * libltdl/loaders/preopen.c (lt_dlpreload_open): Move error condition out of test loop to be sure that each originator is tried, instead of erroring out if the first doesn't match. Support passing NULL as the originator to load all preloaded modules originating in the program itself. * libltdl/lt_dlloader.c (lt_dlloader_dump): New debug function. * libltdl/libltdl/lt_dlloader.h (lt_dlloader_dump): Declare it when LT_DEBUG_LOADERS is defined at compile time. * libltdl/ltdl.c (lt_dlinit): Dump loader list after successful initialisation. (tryall_dlopen): Add a new VTABLE parameter to force use of a specific loader in preference to trying every loader in turn. Adjust all callers. (try_dlopen): Always see whether a module was preloaded for module names with no directory component before searching the filesystem for a match. * libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Declare a new global_symbol_to_c_name_address_lib_prefix variable. (global_symbol_to_c_name_address_lib_prefix): The sed expressions to use when a lib prefix is enforced need to be slightly different to work with preloaded modules. * libltdl/config/ltmain.m4sh (func_generate_dlsyms): In order to name preloaded symbols correctly for the lookup algorithm to work when the loaded module file must be prefixed with lib. Use global_symbol_to_c_name_address_lib_prefix when need_lib_prefix is other than no. * tests/need_lib_prefix.at: New test to check for breakage on hosts where need_lib_prefix is unknown. * Makefile.am (TESTSUITE_AT): Add new test. * tests/TODO: Note missing tests that would have caught some of the latent bugs fixed by this patch. * HACKING: Document libltdl keyword. * NEWS: Updated.
2007-06-25 04:46:47 +08:00
#ifdef LT_DEBUG_LOADERS
static void *
loader_dump_callback (SList *item, void *userdata)
{
const lt_dlvtable *vtable = (const lt_dlvtable *) item->userdata;
fprintf (stderr, ", %s", (vtable && vtable->name) ? vtable->name : "(null)");
return 0;
}
void
lt_dlloader_dump (void)
{
fprintf (stderr, "loaders: ");
if (!loaders)
{
fprintf (stderr, "(empty)");
}
else
{
const lt_dlvtable *head = (const lt_dlvtable *) loaders->userdata;
fprintf (stderr, "%s", (head && head->name) ? head->name : "(null)");
if (slist_tail (loaders))
slist_foreach (slist_tail (loaders), loader_dump_callback, NULL);
}
fprintf (stderr, "\n");
}
#endif
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
/* An iterator for the global loader list: if LOADER is NULL, then
return the first element, otherwise the following element. */
lt_dlloader
lt_dlloader_next (lt_dlloader loader)
{
SList *item = (SList *) loader;
return (lt_dlloader) (item ? item->next : loaders);
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
}
/* Non-destructive unboxing of a loader. */
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
const lt_dlvtable *
lt_dlloader_get (lt_dlloader loader)
{
return (const lt_dlvtable *) (loader ? ((SList *) loader)->userdata : NULL);
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
}
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
/* Return the contents of the first item in the global loader list
with a matching NAME after removing it from that list. If there
was no match, return NULL; if there is an error, return NULL and
set an error for lt_dlerror; do not set an error if only resident
modules need this loader; in either case, the loader list is not
changed if NULL is returned. */
lt_dlvtable *
lt_dlloader_remove (const char *name)
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
const lt_dlvtable * vtable = lt_dlloader_find (name);
static const char id_string[] = "lt_dlloader_remove";
lt_dlinterface_id iface;
lt_dlhandle handle = 0;
int in_use = 0;
int in_use_by_resident = 0;
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
if (!vtable)
{
LT__SETERROR (INVALID_LOADER);
return 0;
}
/* Fail if there are any open modules that use this loader. */
iface = lt_dlinterface_register (id_string, NULL);
if (!iface)
/* No memory, error is already set. */
return 0;
while ((handle = lt_dlhandle_iterate (iface, handle)))
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
lt_dlhandle cur = handle;
if (cur->vtable == vtable)
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
in_use = 1;
if (lt_dlisresident (handle))
in_use_by_resident = 1;
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
}
}
lt_dlinterface_free (iface);
if (in_use)
{
if (!in_use_by_resident)
LT__SETERROR (REMOVE_LOADER);
return 0;
}
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
/* Call the loader finalisation function. */
if (vtable && vtable->dlloader_exit)
{
if ((*vtable->dlloader_exit) (vtable->dlloader_data) != 0)
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
/* If there is an exit function, and it returns non-zero
then it must set an error, and we will not remove it
from the list. */
return 0;
}
}
/* If we got this far, remove the loader from our global list. */
return (lt_dlvtable *)
slist_unbox ((SList *) slist_remove (&loaders, loader_callback, (void *) name));
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
}
const lt_dlvtable *
lt_dlloader_find (const char *name)
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
{
return lt_dlloader_get (slist_find (loaders, loader_callback, (void *) name));
Split lt_dlloader management into a separate file, and factor `loaders' list management into a new SList ADT. In the process, the API for writing loaders is a little cleaner, so all the existing loaders were tweaked to take advantage of that: * libltdl/slist.h, libltdl/slist.c: New files implementing a generic singly linked list container ADT. The ADT is purely internal, and none of its API's are visible from an installed libltdl. * libltdl/lt_dlloader.h (lt_dlloader): Removed next field again :-) Renamed to lt_dlvtable for API. Changed all callers. (lt_dlloader_get): New function to turn an lt_dlloader into its associated lt_dlvtable. (lt_dlloader_add): Removed unused data parameter. The caller data belongs to (and is set by) the loader itself, not the loader's client. Changed all callers. (lt_dlloader_name, lt_dlloader_data): Removed. Use lt_dlloader_get instead! * libltdl/lt__private.h: Include slist.h. (lt__alloc_die_callback): Add missing LT_SCOPE to declaration. (lt_dlhandle_struct): Use lt_dlvtable instead of opaque lt_dlloader. * libltdl/ltdl.c (lt_dlexit): Rewritten for the new loader API. (loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): Moved from here... * libltdl/lt_dlloader.c ((loaders, lt_dlloader_add, lt_dlloader_remove, lt_dlloader_next, lt_dlloader_find): ...to here. And rewritten in terms of new SList interface. * libltdl/ltdl.c (lt_dlexit, tryall_dlopen): Rewritten in terms of new lt_dlloader interface. * libltdl/Makefile.am (libdlloader_la_SOURCES): Add slist.h and slist.c. Move lt_dlloader.h from here... (pkginclude_HEADERS): ...to here. (libltdl_la_SOURCES): Add lt_dlloader.c and lt_dlloader.h.
2004-07-15 20:33:20 +08:00
}