From: Robert K. <may...@us...> - 2001-07-09 21:19:55
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory usw-pr-cvs1:/tmp/cvs-serv10439/lib Modified Files: Makefile.am plugin_man.c Log Message: Converted the dlopen stuff to use the libtool ltdlopen stuff for greater portability. Index: Makefile.am =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** Makefile.am 2001/04/06 04:49:12 1.9 --- Makefile.am 2001/07/09 21:19:52 1.10 *************** *** 7,15 **** AUTOMAKE_OPTIONS = foreign ! INCLUDES = -I$(top_srcdir)/.. -I$(top_srcdir)/ver -I$(top_srcdir)/include lib_LTLIBRARIES = libbitcollider.la libbitcollider_la_SOURCES = main.c sha1.c tiger.c tigertree.c sboxes.c browser.c mp3.c id3.c plugin_man.c plugin_man.h dirsearch.c dir.h libbitcollider_la_LDFLAGS = -version-info 1:0:0 ! libbitcollider_la_LIBADD = -ldl noinst_HEADERS = browser.h mp3.h id3.h --- 7,15 ---- AUTOMAKE_OPTIONS = foreign ! INCLUDES = $(INCLTDL) -I$(top_srcdir)/.. -I$(top_srcdir)/ver -I$(top_srcdir)/include lib_LTLIBRARIES = libbitcollider.la libbitcollider_la_SOURCES = main.c sha1.c tiger.c tigertree.c sboxes.c browser.c mp3.c id3.c plugin_man.c plugin_man.h dirsearch.c dir.h libbitcollider_la_LDFLAGS = -version-info 1:0:0 ! libbitcollider_la_LIBADD = $(LIBLTDL) noinst_HEADERS = browser.h mp3.h id3.h Index: plugin_man.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/plugin_man.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** plugin_man.c 2001/04/06 04:49:12 1.10 --- plugin_man.c 2001/07/09 21:19:52 1.11 *************** *** 11,15 **** #include <sys/types.h> #include <dirent.h> ! #include <dlfcn.h> #include "bitcollider.h" --- 11,15 ---- #include <sys/types.h> #include <dirent.h> ! #include <ltdl.h> #include "bitcollider.h" *************** *** 69,77 **** /* Found one, lets open it */ ! bc->plugins[bc->numPluginsLoaded].handle = dlopen(file, RTLD_NOW); if (bc->plugins[bc->numPluginsLoaded].handle == NULL) { if (printDebugInfo) ! printf("Cannot load plugin %s. (%s)\n", file, dlerror()); continue; } --- 69,77 ---- /* Found one, lets open it */ ! bc->plugins[bc->numPluginsLoaded].handle = lt_dlopen(file); if (bc->plugins[bc->numPluginsLoaded].handle == NULL) { if (printDebugInfo) ! printf("Cannot load plugin %s. (%s)\n", file, lt_dlerror()); continue; } *************** *** 79,87 **** /* Opened plugin ok, now locate our entry function */ ! init_function = dlsym(bc->plugins[bc->numPluginsLoaded].handle, "init_plugin"); if (init_function == NULL) { ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot find entry point in %s.\n", file); --- 79,87 ---- /* Opened plugin ok, now locate our entry function */ ! init_function = lt_dlsym(bc->plugins[bc->numPluginsLoaded].handle, "init_plugin"); if (init_function == NULL) { ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot find entry point in %s.\n", file); *************** *** 93,97 **** if (bc->plugins[bc->numPluginsLoaded].methods == NULL) { ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot retrieve supported methods from %s.\n", file); --- 93,97 ---- if (bc->plugins[bc->numPluginsLoaded].methods == NULL) { ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); if (printDebugInfo) printf("Cannot retrieve supported methods from %s.\n", file); *************** *** 122,126 **** bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; --- 122,126 ---- bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; *************** *** 155,159 **** { bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; --- 155,159 ---- { bc->plugins[bc->numPluginsLoaded].methods->shutdown_plugin(); ! lt_dlclose(bc->plugins[bc->numPluginsLoaded].handle); bc->plugins[bc->numPluginsLoaded].handle = NULL; bc->plugins[bc->numPluginsLoaded].methods = NULL; |