? cxxdemo ? patches ? libltdl/ltdl.h.new ? libltdl/ltdl.c.new ? libltdl/ltdl-beos.c ? libltdl/ltdl-dl.c ? libltdl/ltdl-dld.c ? libltdl/ltdl-preload.c ? libltdl/ltdl-shl.c ? libltdl/ltdl-windows.c Index: doc/libtool.texi =================================================================== RCS file: /home/cvs/libtool/doc/libtool.texi,v retrieving revision 1.107 diff -u -p -r1.107 libtool.texi --- doc/libtool.texi 2000/11/11 11:40:55 1.107 +++ doc/libtool.texi 2000/11/17 22:36:16 @@ -2500,13 +2500,13 @@ In order to use this feature, you must d application to dlopen by using the @samp{-dlopen} or @samp{-dlpreopen} flags when you link your program (@pxref{Link mode}). address@hidden {Structure} {struct} lt_dlsymlist @{ @w{const char address@hidden;} @w{lt_ptr_t @var{address};} @} address@hidden {Structure} {struct} lt_dlsymlist @{ @w{const char address@hidden;} @w{lt_ptr @var{address};} @} The @var{name} attribute is a null-terminated character string of the symbol name, such as @code{"fprintf"}. The @var{address} attribute is a generic pointer to the appropriate object, such as @code{&fprintf}. @end deftypefn address@hidden {const lt_dlsymlist *} lt_preloaded_symbols address@hidden {const lt_dlsymlist *}lt_preloaded_symbols An array of @var{lt_symbol} structures, representing all the preloaded symbols linked into the program. For each @samp{-dlpreloaded} file there is an element with the @var{name} of the file and a @var{address} @@ -2665,8 +2665,8 @@ certainly welcome. @noindent The following types are defined in @file{ltdl.h}: address@hidden {Type} lt_ptr_t address@hidden is a generic pointer. address@hidden {Type} lt_ptr address@hidden is a generic pointer. @end deftp @deftp {Type} lt_dlhandle @@ -2774,13 +2774,13 @@ then the module is unloaded. Return 0 on success. @end deftypefun address@hidden lt_ptr_t lt_dlsym (lt_dlhandle @var{handle}, const char address@hidden) address@hidden lt_ptr lt_dlsym (lt_dlhandle @var{handle}, const char address@hidden) Return the address in the module @var{handle}, where the symbol given by the null-terminated string @var{name} is loaded. If the symbol cannot be found, @code{NULL} is returned. @end deftypefun address@hidden {const char *} lt_dlerror (void) address@hidden {const char *}lt_dlerror (void) Return a human readable string describing the most recent error that occurred from any of libltdl's functions. Return @code{NULL} if no errors have occurred since initialization @@ -2832,17 +2832,17 @@ Replace the current user-defined library directories. Return 0 on success. @end deftypefun address@hidden {const char *} lt_dlgetsearchpath (void) address@hidden {const char *}lt_dlgetsearchpath (void) Return the current user-defined library search path. @end deftypefun address@hidden {const lt_dlinfo *} lt_dlgetinfo (lt_dlhandle @var{handle}) address@hidden {const lt_dlinfo *}lt_dlgetinfo (lt_dlhandle @var{handle}) Return a pointer to a struct that contains some information about the module @var{handle}. The contents of the struct must not be modified. Return @code{NULL} on failure. @end deftypefun address@hidden int lt_dlforeach (int (address@hidden)(lt_dlhandle @var{handle}, lt_ptr_t @var{data}), lt_ptr_t @var{data}) address@hidden int lt_dlforeach (int (address@hidden)(lt_dlhandle @var{handle}, lt_ptr @var{data}), lt_ptr @var{data}) For each loaded module call the function @var{func}. The argument @var{handle} is the handle of one of the loaded modules, @var{data} is the @var{data} argument passed to @code{lt_dlforeach}. @@ -2851,8 +2851,8 @@ As soon as @var{func} returns a non-zero Otherwise 0 is returned. @end deftypefun address@hidden {lt_ptr_t (*} lt_dlmalloc ) (size_t @var{size}) address@hidden {void (*} lt_dlfree ) (lt_ptr_t @var{ptr}) address@hidden {lt_ptr (*) (size_t @var{size})} lt_dlmalloc address@hidden {void (*) (lt_ptr @var{ptr})} lt_dlfree These variables are set to @code{malloc} and @code{free}, by default, but you can set them to any other functions that provides equivalent functionality. However, you must not modify their values after calling @@ -3102,21 +3102,21 @@ libltdl, so you should not use that for @noindent The following types are defined in @file{ltdl.h}: address@hidden {Type} lt_module_t address@hidden is a dlloader dependent module. address@hidden {Type} lt_module address@hidden is a dlloader dependent module. The dynamic module loader extensions communicate using these low level types. @end deftp address@hidden {Type} lt_dlloader_t address@hidden is a handle for module loader types. address@hidden {Type} lt_dlloader address@hidden is a handle for module loader types. @end deftp address@hidden {Type} lt_dlloader_data_t address@hidden is used for specifying loader instance data. address@hidden {Type} lt_dlloader_data address@hidden is used for specifying loader instance data. @end deftp address@hidden {Type} {struct} lt_user_dlloader @address@hidden char address@hidden;} @w{lt_module_open_t address@hidden;address@hidden address@hidden;} @w{lt_find_sym_t address@hidden;} @w{lt_dlloader_exit_t address@hidden;} @w{lt_dlloader_data_t @var{dlloader_data};} @} address@hidden {Type} {struct} lt_user_dlloader @address@hidden char address@hidden;} @w{lt_module_open address@hidden;address@hidden address@hidden;} @w{lt_find_sym address@hidden;} @w{lt_dlloader_exit address@hidden;} @w{lt_dlloader_data @var{dlloader_data};} @} If you want to define a new way to open dynamic modules, and have the @code{lt_dlopen} @sc{api} use it, you need to instantiate one of these structures and pass it to @code{lt_dlloader_add}. You can pass whatever @@ -3125,18 +3125,18 @@ the value of the first parameter to each the function pointer fields. @end deftypefn address@hidden {Type} lt_module_t lt_module_open_t (@w{lt_dlloader_data_t @var{loader_data},} @w{const char address@hidden) -The type of the loader function for an @code{lt_dlloader_t} module address@hidden {Type} lt_module lt_module_open (@w{lt_user_data @var{loader_data},} @w{const char address@hidden) +The type of the loader function for an @code{lt_dlloader} module loader. The value set in the dlloader_data field of the @code{struct lt_user_dlloader} structure will be passed into this function in the @var{loader_data} parameter. Implementation of such a function should -attempt to load the named module, and return an @code{lt_module_t} -suitable for passing in to the associated @code{lt_module_close_t} and address@hidden function pointers. If the function fails it should +attempt to load the named module, and return an @code{lt_module} +suitable for passing in to the associated @code{lt_module_close} and address@hidden function pointers. If the function fails it should return @code{NULL}, and set the error message with @code{lt_dlseterror}. @end deftypefn address@hidden {Type} int lt_module_close_t (@w{lt_dlloader_data_t @var{loader_data},} @w{lt_module_t @var{module}}) address@hidden {Type} int lt_module_close (@w{lt_dlloader_data @var{loader_data},} @w{lt_module @var{module}}) The type of the unloader function for a user defined module loader. Implementatation of such a function should attempt to release any resources tied up by the @var{module} module, and then unload it @@ -3144,14 +3144,14 @@ from memory. If the function fails for message with @code{lt_dlseterror} and return non-zero. @end deftypefn address@hidden {Type} lt_ptr_t lt_find_sym_t (@w{lt_dlloader_data_t @var{loader_data},} @w{lt_module_t @var{module},} @w{const char address@hidden) address@hidden {Type} lt_ptr lt_find_sym (@w{lt_user_data @var{loader_data},} @w{lt_module @var{module},} @w{const char address@hidden) The type of the symbol lookup function for a user defined module loader. Implementation of such a function should return the address of the named @var{symbol} in the module @var{module}, or else set the error message with @code{lt_dlseterror} and return @code{NULL} if lookup fails. @end deftypefn address@hidden {Type} int lt_dlloader_exit_t (@w{lt_dlloader_data_t @var{loader_data}}) address@hidden {Type} int lt_dlloader_exit (@w{lt_user_data @var{loader_data}}) The type of the finalisation function for a user defined module loader. Implementation of such a function should free any resources associated with the loader, including any user specified data in the @@ -3177,7 +3177,7 @@ register_myloader (void) dlloader.module_close = myloader_close; dlloader.find_sym = myloader_find_sym. dlloader.dlloader_exit = myloader_exit; - dlloader.dlloader_data = (lt_dlloader_data_t)myloader_function; + dlloader.dlloader_data = (lt_user_data)myloader_function; /* Add my loader as the default module loader. */ if (lt_dlloader_add (lt_dlloader_next (NULL), &dlloader, "myloader") != 0) @@ -3200,7 +3200,7 @@ during the initialisation phase. libltdl provides the following functions for writing your own module loaders: address@hidden int lt_dlloader_add (@w{lt_dlloader_t address@hidden,} @w{lt_user_dlloader address@hidden,} @w{const char address@hidden) address@hidden int lt_dlloader_add (@w{lt_dlloader address@hidden,} @w{lt_user_dlloader address@hidden,} @w{const char address@hidden) Add a new module loader to the list of all loaders, either as the last loader (if @var{place} is @code{NULL}), else immediately before the loader passed as @var{place}. @var{loader_name} will be returned by @@ -3233,7 +3233,7 @@ be obtained from @code{lt_dlerror}. @end example @end deftypefun address@hidden {lt_dlloader_t *}lt_dlloader_next (@w{lt_dlloader_t address@hidden) address@hidden {lt_dlloader *}lt_dlloader_next (@w{lt_dlloader address@hidden) Iterate over the module loaders, returning the first loader if @var{place} is @code{NULL}, and the next one on subsequent calls. The handle is for use with @code{lt_dlloader_add}. @@ -3247,7 +3247,7 @@ Iterate over the module loaders, returni @end example @end deftypefun address@hidden {lt_dlloader_t *}lt_dlloader_find (@w{const char address@hidden) address@hidden {lt_dlloader *}lt_dlloader_find (@w{const char address@hidden) Return the first loader with a matching @var{loader_name} identifier, or else @code{NULL}, if the identifier is not found. @@ -3266,14 +3266,14 @@ the host dependent module loading @sc{ap @end example @end deftypefun address@hidden {const char *}lt_dlloader_name (@w{lt_dlloader_t address@hidden) address@hidden {const char *}lt_dlloader_name (@w{lt_dlloader address@hidden) Return the identifying name of @var{PLACE}, as obtained from @code{lt_dlloader_next} or @code{lt_dlloader_find}. If this function fails, it will return @code{NULL} and set an error for retrieval with @code{lt_dlerror}. @end deftypefun address@hidden {lt_dlloader_data_t *}lt_dlloader_data (@w{lt_dlloader_t address@hidden) address@hidden {lt_user_data *}lt_dlloader_data (@w{lt_dlloader address@hidden) Return the address of the @code{dlloader_data} of @var{PLACE}, as obtained from @code{lt_dlloader_next} or @code{lt_dlloader_find}. If this function fails, it will return @code{NULL} and set an error for Index: libltdl/ltdl.c =================================================================== RCS file: /home/cvs/libtool/libltdl/ltdl.c,v retrieving revision 1.112 diff -u -p -r1.112 ltdl.c --- libltdl/ltdl.c 2000/11/17 18:44:28 1.112 +++ libltdl/ltdl.c 2000/11/17 22:36:16 @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite */ #if HAVE_CONFIG_H -#include +# include #endif #if HAVE_STDIO_H @@ -66,17 +66,17 @@ Foundation, Inc., 59 Temple Place, Suite #ifdef DLL_EXPORT -# define LTDL_GLOBAL_DATA __declspec(dllexport) +# define LT_GLOBAL_DATA __declspec(dllexport) #else -# define LTDL_GLOBAL_DATA +# define LT_GLOBAL_DATA #endif /* fopen() mode flags for reading a text file */ -#undef LTDL_READTEXT_MODE +#undef LT_READTEXT_MODE #ifdef __WINDOWS__ -# define LTDL_READTEXT_MODE "rt" +# define LT_READTEXT_MODE "rt" #else -# define LTDL_READTEXT_MODE "r" +# define LT_READTEXT_MODE "r" #endif @@ -86,43 +86,43 @@ Foundation, Inc., 59 Temple Place, Suite /* max. filename length */ -#ifndef LTDL_FILENAME_MAX -# define LTDL_FILENAME_MAX 1024 +#ifndef LT_FILENAME_MAX +# define LT_FILENAME_MAX 1024 #endif /* This is the maximum symbol size that won't require malloc/free */ -#undef LTDL_SYMBOL_LENGTH -#define LTDL_SYMBOL_LENGTH 128 +#undef LT_SYMBOL_LENGTH +#define LT_SYMBOL_LENGTH 128 /* This accounts for the _LTX_ separator */ -#undef LTDL_SYMBOL_OVERHEAD -#define LTDL_SYMBOL_OVERHEAD 5 +#undef LT_SYMBOL_OVERHEAD +#define LT_SYMBOL_OVERHEAD 5 /* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */ /* This structure is used for the list of registered loaders. */ -struct lt_dlloader_t { - struct lt_dlloader_t *next; +struct lt_dlloader { + struct lt_dlloader *next; const char *loader_name; /* identifying name for each loader */ const char *sym_prefix; /* prefix for symbols */ - lt_module_open_t *module_open; - lt_module_close_t *module_close; - lt_find_sym_t *find_sym; - lt_dlloader_exit_t *dlloader_exit; - lt_dlloader_data_t dlloader_data; + lt_module_open *module_open; + lt_module_close *module_close; + lt_find_sym *find_sym; + lt_dlloader_exit *dlloader_exit; + lt_user_data dlloader_data; }; -typedef struct lt_dlhandle_t { - struct lt_dlhandle_t *next; - lt_dlloader_t *loader; /* dlopening interface */ +struct lt_dlhandle { + struct lt_dlhandle *next; + lt_dlloader *loader; /* dlopening interface */ lt_dlinfo info; int depcount; /* number of dependencies */ lt_dlhandle *deplibs; /* dependencies */ - lt_module_t module; /* system module handle */ - lt_ptr_t system; /* system specific data */ -} lt_dlhandle_t; + lt_module module; /* system module handle */ + lt_ptr system; /* system specific data */ +}; static const char objdir[] = LTDL_OBJDIR; #ifdef LTDL_SHLIB_EXT @@ -132,10 +132,10 @@ static const char shlib_ext[] = LTDL_SH static const char sys_search_path[] = LTDL_SYSSEARCHPATH; #endif -LTDL_GLOBAL_DATA lt_ptr_t (*lt_dlmalloc) LTDL_PARAMS((size_t size)) - = (lt_ptr_t(*)LTDL_PARAMS((size_t)))malloc; -LTDL_GLOBAL_DATA void (*lt_dlfree) LTDL_PARAMS((lt_ptr_t ptr)) - = (void(*)LTDL_PARAMS((lt_ptr_t)))free; +LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size)) + = (lt_ptr (*) LT_PARAMS((size_t))) malloc; +LT_GLOBAL_DATA void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)) + = (void (*) LT_PARAMS((lt_ptr))) free; @@ -145,26 +145,26 @@ LTDL_GLOBAL_DATA void (*lt_dlfree) LT /* Extract the diagnostic strings from the error table macro in the same order as the enumberated indices in ltdl.h. */ -static const char *ltdl_error_strings[] = +static const char *lt_dlerror_strings[] = { -#define LTDL_ERROR(name, diagnostic) (diagnostic), - ltdl_error_table -#undef LTDL_ERROR +#define LT_ERROR(name, diagnostic) (diagnostic), + lt_dlerror_table +#undef LT_ERROR 0 }; -#define LT_DLSTRERROR(name) ltdl_error_strings[LTDL_CONC(LTDL_ERROR_,name)] +#define LT_DLSTRERROR(name) lt_dlerror_strings[LT_CONC(LT_ERROR_,name)] static const char *last_error = 0; static const char **user_error_strings = 0; -static int errorcode = LTDL_ERROR_MAX; +static int errorcode = LT_ERROR_MAX; int lt_dladderror (diagnostic) const char *diagnostic; { - int index = errorcode - LTDL_ERROR_MAX; + int index = errorcode - LT_ERROR_MAX; const char **temp = 0; /* realloc is not entirely portable, so simulate it using @@ -199,13 +199,13 @@ lt_dlseterror (index) return 1; } - if (index < LTDL_ERROR_MAX) + if (index < LT_ERROR_MAX) { - last_error = ltdl_error_strings[errorcode]; + last_error = lt_dlerror_strings[errorcode]; } else { - last_error = user_error_strings[errorcode - LTDL_ERROR_MAX]; + last_error = user_error_strings[errorcode - LT_ERROR_MAX]; } return 0; @@ -337,39 +337,39 @@ strrchr(str, ch) #endif #ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL +# define LT_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL +# define LT_GLOBAL DL_GLOBAL # endif #endif /* !RTLD_GLOBAL */ -#ifndef LTDL_GLOBAL -# define LTDL_GLOBAL 0 -#endif /* !LTDL_GLOBAL */ +#ifndef LT_GLOBAL +# define LT_GLOBAL 0 +#endif /* !LT_GLOBAL */ -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we +/* We may have to define LT_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW +#ifndef LT_LAZY_OR_NOW # ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY +# define LT_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY +# define LT_LAZY_OR_NOW DL_LAZY # endif # endif /* !RTLD_LAZY */ #endif -#ifndef LTDL_LAZY_OR_NOW +#ifndef LT_LAZY_OR_NOW # ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW +# define LT_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW +# define LT_LAZY_OR_NOW DL_NOW # endif # endif /* !RTLD_NOW */ #endif -#ifndef LTDL_LAZY_OR_NOW -# define LTDL_LAZY_OR_NOW 0 -#endif /* !LTDL_LAZY_OR_NOW */ +#ifndef LT_LAZY_OR_NOW +# define LT_LAZY_OR_NOW 0 +#endif /* !LT_LAZY_OR_NOW */ #if HAVE_DLERROR # define DLERROR(arg) dlerror () @@ -377,12 +377,12 @@ strrchr(str, ch) # define DLERROR(arg) LT_DLSTRERROR (arg) #endif -static lt_module_t +static lt_module sys_dl_open (loader_data, filename) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; const char *filename; { - lt_module_t module = dlopen (filename, LTDL_GLOBAL | LTDL_LAZY_OR_NOW); + lt_module module = dlopen (filename, LT_GLOBAL | LT_LAZY_OR_NOW); if (!module) { @@ -394,8 +394,8 @@ sys_dl_open (loader_data, filename) static int sys_dl_close (loader_data, module) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; { if (dlclose (module) != 0) { @@ -405,13 +405,13 @@ sys_dl_close (loader_data, module) return 0; } -static lt_ptr_t +static lt_ptr sys_dl_sym (loader_data, module, symbol) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; const char *symbol; { - lt_ptr_t address = dlsym(module, symbol); + lt_ptr address = dlsym (module, symbol); if (!address) { @@ -483,14 +483,14 @@ static struct lt_user_dlloader sys_dl = # define BIND_RESTRICTED 0 #endif -#define LTDL_BIND_FLAGS (BIND_IMMEDIATE | BIND_NONFATAL | DYNAMIC_PATH) +#define LT_BIND_FLAGS (BIND_IMMEDIATE | BIND_NONFATAL | DYNAMIC_PATH) -static lt_module_t +static lt_module sys_shl_open (loader_data, filename) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; const char *filename; { - lt_module_t module = shl_load (filename, LTDL_BIND_FLAGS, 0L); + lt_module module = shl_load (filename, LT_BIND_FLAGS, 0L); if (!module) { @@ -502,8 +502,8 @@ sys_shl_open (loader_data, filename) static int sys_shl_close (loader_data, module) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; { if (shl_unload ((shl_t) (module)) != 0) { @@ -514,13 +514,13 @@ sys_shl_close (loader_data, module) return 0; } -static lt_ptr_t +static lt_ptr sys_shl_sym (loader_data, module, symbol) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; const char *symbol; { - lt_ptr_t address; + lt_ptr address; if (module && shl_findsym ((shl_t*) &module, symbol, TYPE_UNDEFINED, &address) == 0) @@ -536,8 +536,9 @@ sys_shl_sym (loader_data, module, symbol return 0; } -static struct lt_user_dlloader -sys_shl = { 0, sys_shl_open, sys_shl_close, sys_shl_sym, 0, 0 }; +static struct lt_user_dlloader sys_shl = { + 0, sys_shl_open, sys_shl_close, sys_shl_sym, 0, 0 +}; #endif /* HAVE_SHL_LOAD */ @@ -555,16 +556,16 @@ sys_shl = { 0, sys_shl_open, sys_shl_clo /* Forward declaration; required to implement handle search below. */ static lt_dlhandle handles; -static lt_module_t +static lt_module sys_wll_open (loader_data, filename) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; const char *filename; { - lt_dlhandle cur; - lt_module_t module; - char *searchname = 0; - char *ext; - char self_name_buf[MAX_PATH]; + lt_dlhandle cur; + lt_module module; + char *searchname = 0; + char *ext; + char self_name_buf[MAX_PATH]; if (!filename) { @@ -636,8 +637,8 @@ sys_wll_open (loader_data, filename) static int sys_wll_close (loader_data, module) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; { if (FreeLibrary(module) == 0) { @@ -648,13 +649,13 @@ sys_wll_close (loader_data, module) return 0; } -static lt_ptr_t +static lt_ptr sys_wll_sym (loader_data, module, symbol) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; const char *symbol; { - lt_ptr_t address = GetProcAddress (module, symbol); + lt_ptr address = GetProcAddress (module, symbol); if (!address) { @@ -664,8 +665,9 @@ sys_wll_sym (loader_data, module, symbol return address; } -static struct lt_user_dlloader -sys_wll = { 0, sys_wll_open, sys_wll_close, sys_wll_sym, 0, 0 }; +static struct lt_user_dlloader sys_wll = { + 0, sys_wll_open, sys_wll_close, sys_wll_sym, 0, 0 +}; #endif /* __WINDOWS__ */ @@ -681,9 +683,9 @@ sys_wll = { 0, sys_wll_open, sys_wll_clo #include -static lt_module_t +static lt_module sys_bedl_open (loader_data, filename) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; const char *filename; { image_id image = 0; @@ -706,13 +708,13 @@ sys_bedl_open (loader_data, filename) return 0; } - return (lt_module_t) image; + return (lt_module) image; } static int sys_bedl_close (loader_data, module) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; { if (unload_add_on ((image_id) module) != B_OK) { @@ -723,13 +725,13 @@ sys_bedl_close (loader_data, module) return 0; } -static lt_ptr_t +static lt_ptr sys_bedl_sym (loader_data, module, symbol) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; const char *symbol; { - lt_ptr_t address = 0; + lt_ptr address = 0; image_id image = (image_id) module; if (get_image_symbol (image, symbol, B_SYMBOL_TYPE_ANY, address) != B_OK) @@ -741,8 +743,9 @@ sys_bedl_sym (loader_data, module, symbo return address; } -static struct lt_user_dlloader -sys_bedl = { 0, sys_bedl_open, sys_bedl_close, sys_bedl_sym, 0, 0 }; +static struct lt_user_dlloader sys_bedl = { + 0, sys_bedl_open, sys_bedl_close, sys_bedl_sym, 0, 0 +}; #endif /* __BEOS__ */ @@ -760,12 +763,12 @@ sys_bedl = { 0, sys_bedl_open, sys_bedl_ #include #endif -static lt_module_t +static lt_module sys_dld_open (loader_data, filename) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; const char *filename; { - lt_module_t module = strdup(filename); + lt_module module = strdup (filename); if (!module) { @@ -785,8 +788,8 @@ sys_dld_open (loader_data, filename) static int sys_dld_close (loader_data, module) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; { if (dld_unlink_by_file ((char*)(module), 1) != 0) { @@ -798,13 +801,13 @@ sys_dld_close (loader_data, module) return 0; } -static lt_ptr_t +static lt_ptr sys_dld_sym (loader_data, module, symbol) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; const char *symbol; { - lt_ptr_t address = dld_get_func (symbol); + lt_ptr address = dld_get_func (symbol); if (!address) { @@ -814,8 +817,9 @@ sys_dld_sym (loader_data, module, symbol return address; } -static struct lt_user_dlloader -sys_dld = { 0, sys_dld_open, sys_dld_close, sys_dld_sym, 0, 0 }; +static struct lt_user_dlloader sys_dld = { + 0, sys_dld_open, sys_dld_close, sys_dld_sym, 0, 0 +}; #endif /* HAVE_DLD */ @@ -838,7 +842,7 @@ static lt_dlsymlists_t *preloaded static int presym_init (loader_data) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; { preloaded_symbols = 0; @@ -851,7 +855,7 @@ presym_init (loader_data) } static int -presym_free_symlists LTDL_PARAMS((void)) +presym_free_symlists () { lt_dlsymlists_t *lists = preloaded_symbols; @@ -869,7 +873,7 @@ presym_free_symlists LTDL_PARAMS((void)) static int presym_exit (loader_data) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; { presym_free_symlists (); return 0; @@ -904,9 +908,9 @@ presym_add_symlist (preloaded) return 0; } -static lt_module_t +static lt_module presym_open (loader_data, filename) - lt_dlloader_data_t loader_data; + lt_user_data loader_data; const char *filename; { lt_dlsymlists_t *lists = preloaded_symbols; @@ -930,7 +934,7 @@ presym_open (loader_data, filename) { if (!syms->address && strcmp(syms->name, filename) == 0) { - return (lt_module_t) syms; + return (lt_module) syms; } ++syms; } @@ -945,18 +949,18 @@ presym_open (loader_data, filename) static int presym_close (loader_data, module) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; { /* Just to silence gcc -Wall */ module = 0; return 0; } -static lt_ptr_t +static lt_ptr presym_sym (loader_data, module, symbol) - lt_dlloader_data_t loader_data; - lt_module_t module; + lt_user_data loader_data; + lt_module module; const char *symbol; { lt_dlsymlist *syms = (lt_dlsymlist*) module; @@ -977,8 +981,9 @@ presym_sym (loader_data, module, symbol) return 0; } -static struct lt_user_dlloader -presym = { 0, presym_open, presym_close, presym_sym, presym_exit, 0 }; +static struct lt_user_dlloader presym = { + 0, presym_open, presym_close, presym_sym, presym_exit, 0 +}; @@ -988,12 +993,12 @@ presym = { 0, presym_open, presym_close, static char *user_search_path= 0; -static lt_dlloader_t *loaders = 0; +static lt_dlloader *loaders = 0; static lt_dlhandle handles = 0; static int initialized = 0; int -lt_dlinit LTDL_PARAMS((void)) +lt_dlinit () { /* initialize libltdl */ int errors = 0; @@ -1070,7 +1075,7 @@ int lt_dlexit () { /* shut down libltdl */ - lt_dlloader_t *loader = loaders; + lt_dlloader *loader = loaders; int errors = 0; if (!initialized) @@ -1105,8 +1110,8 @@ lt_dlexit () /* close all loaders */ while (loader) { - lt_dlloader_t *next = loader->next; - lt_dlloader_data_t data = loader->dlloader_data; + lt_dlloader *next = loader->next; + lt_user_data data = loader->dlloader_data; if (loader->dlloader_exit && loader->dlloader_exit (data)) { ++errors; @@ -1126,7 +1131,7 @@ tryall_dlopen (handle, filename) const char *filename; { lt_dlhandle cur = handles; - lt_dlloader_t *loader = loaders; + lt_dlloader *loader = loaders; const char *saved_error = last_error; /* check whether the module was already opened */ @@ -1171,7 +1176,7 @@ tryall_dlopen (handle, filename) while (loader) { - lt_dlloader_data_t data = loader->dlloader_data; + lt_user_data data = loader->dlloader_data; cur->module = loader->module_open (data, filename); if (cur->module != 0) @@ -1312,9 +1317,9 @@ canonicalize_path (path) char *ptr = strdup (path); canonical = ptr; -#ifdef LTDL_DIRSEP_CHAR +#ifdef LT_DIRSEP_CHAR /* Avoid this overhead where '/' is the only separator. */ - while (ptr = strchr (ptr, LTDL_DIRSEP_CHAR)) + while (ptr = strchr (ptr, LT_DIRSEP_CHAR)) { *ptr++ = '/'; } @@ -1324,7 +1329,7 @@ canonicalize_path (path) return canonical; } -static lt_ptr_t +static lt_ptr find_file (basename, search_path, pdir, handle) const char *basename; const char *search_path; @@ -1334,10 +1339,10 @@ find_file (basename, search_path, pdir, /* when handle != NULL search a library, otherwise a file */ /* return NULL on failure, otherwise the file/handle */ - lt_ptr_t result = 0; + lt_ptr result = 0; char *filename = 0; int filenamesize= 0; - int lenbase = strlen(basename); + int lenbase = strlen (basename); char *canonical = 0; char *next = 0; @@ -1360,14 +1365,14 @@ find_file (basename, search_path, pdir, int lendir; char *cur = next; - next = strchr (cur, LTDL_PATHSEP_CHAR); + next = strchr (cur, LT_PATHSEP_CHAR); if (!next) { next = cur + strlen (cur); } lendir = next - cur; - if (*next == LTDL_PATHSEP_CHAR) + if (*next == LT_PATHSEP_CHAR) { ++next; } @@ -1406,15 +1411,15 @@ find_file (basename, search_path, pdir, strcpy(filename+lendir, basename); if (handle) { - if (tryall_dlopen(handle, filename) == 0) + if (tryall_dlopen (handle, filename) == 0) { - result = (lt_ptr_t) handle; + result = (lt_ptr) handle; goto cleanup; } } else { - FILE *file = fopen (filename, LTDL_READTEXT_MODE); + FILE *file = fopen (filename, LT_READTEXT_MODE); if (file) { if (*pdir) @@ -1432,7 +1437,7 @@ find_file (basename, search_path, pdir, filename = 0; } - result = (lt_ptr_t) file; + result = (lt_ptr) file; goto cleanup; } } @@ -1441,8 +1446,8 @@ find_file (basename, search_path, pdir, last_error = LT_DLSTRERROR (FILE_NOT_FOUND); cleanup: - if (filename) lt_dlfree(filename); - if (canonical) lt_dlfree(canonical); + if (filename) lt_dlfree (filename); + if (canonical) lt_dlfree (canonical); return result; } @@ -1464,7 +1469,7 @@ load_deplibs(handle, deplibs) return 0; } - save_search_path = strdup(user_search_path); + save_search_path = strdup (user_search_path); if (user_search_path && !save_search_path) { last_error = LT_DLSTRERROR (NO_MEMORY); @@ -1608,7 +1613,7 @@ load_deplibs(handle, deplibs) if (handles) lt_dlfree(handles); /* restore the old search path */ - if (user_search_path) lt_dlfree(user_search_path); + if (user_search_path) lt_dlfree (user_search_path); user_search_path = save_search_path; return ret; @@ -1693,7 +1698,7 @@ lt_dlopen (filename) if (!filename) { - handle = (lt_dlhandle) lt_dlmalloc (sizeof (lt_dlhandle_t)); + handle = (lt_dlhandle) lt_dlmalloc (sizeof (struct lt_dlhandle)); if (!handle) { last_error = LT_DLSTRERROR (NO_MEMORY); @@ -1786,7 +1791,7 @@ lt_dlopen (filename) name[ext - basename] = '\0'; /* now try to open the .la file */ - file = fopen (filename, LTDL_READTEXT_MODE); + file = fopen (filename, LT_READTEXT_MODE); if (!file) { last_error = LT_DLSTRERROR (FILE_NOT_FOUND); @@ -1822,7 +1827,7 @@ lt_dlopen (filename) goto cleanup; } - line = (char*) lt_dlmalloc (LTDL_FILENAME_MAX); + line = (char*) lt_dlmalloc (LT_FILENAME_MAX); if (!line) { fclose (file); @@ -1834,7 +1839,7 @@ lt_dlopen (filename) /* read the .la file */ while (!feof(file)) { - if (!fgets (line, LTDL_FILENAME_MAX, file)) + if (!fgets (line, LT_FILENAME_MAX, file)) { break; } @@ -1907,7 +1912,7 @@ lt_dlopen (filename) lt_dlfree (line); /* allocate the handle */ - handle = (lt_dlhandle) lt_dlmalloc (sizeof (lt_dlhandle_t)); + handle = (lt_dlhandle) lt_dlmalloc (sizeof (struct lt_dlhandle)); if (!handle || error) { if (handle) @@ -1956,7 +1961,7 @@ lt_dlopen (filename) else { /* not a libtool module */ - handle = (lt_dlhandle) lt_dlmalloc (sizeof (lt_dlhandle_t)); + handle = (lt_dlhandle) lt_dlmalloc (sizeof (struct lt_dlhandle)); if (!handle) { last_error = LT_DLSTRERROR (NO_MEMORY); @@ -2117,7 +2122,7 @@ lt_dlclose (handle) if (!handle->info.ref_count) { int error; - lt_dlloader_data_t data = handle->loader->dlloader_data; + lt_user_data data = handle->loader->dlloader_data; if (handle != handles) { @@ -2149,16 +2154,16 @@ lt_dlclose (handle) return 0; } -lt_ptr_t +lt_ptr lt_dlsym (handle, symbol) lt_dlhandle handle; const char *symbol; { int lensym; - char lsym[LTDL_SYMBOL_LENGTH]; + char lsym[LT_SYMBOL_LENGTH]; char *sym; - lt_ptr_t address; - lt_dlloader_data_t data; + lt_ptr address; + lt_user_data data; if (!handle) { @@ -2183,13 +2188,13 @@ lt_dlsym (handle, symbol) lensym += strlen(handle->info.name); } - if (lensym + LTDL_SYMBOL_OVERHEAD < LTDL_SYMBOL_LENGTH) + if (lensym + LT_SYMBOL_OVERHEAD < LT_SYMBOL_LENGTH) { sym = lsym; } else { - sym = (char*) lt_dlmalloc(lensym + LTDL_SYMBOL_OVERHEAD + 1); + sym = (char*) lt_dlmalloc(lensym + LT_SYMBOL_OVERHEAD + 1); } if (!sym) @@ -2270,7 +2275,7 @@ lt_dladdsearchdir (search_dir) if (!user_search_path) { - user_search_path = strdup(search_dir); + user_search_path = strdup (search_dir); if (!user_search_path) { last_error = LT_DLSTRERROR (NO_MEMORY); @@ -2289,7 +2294,7 @@ lt_dladdsearchdir (search_dir) } sprintf (new_search_path, "%s%c%s", user_search_path, - LTDL_PATHSEP_CHAR, search_dir); + LT_PATHSEP_CHAR, search_dir); lt_dlfree (user_search_path); user_search_path = new_search_path; @@ -2343,8 +2348,8 @@ lt_dlgetinfo (handle) int lt_dlforeach (func, data) - int (*func) LTDL_PARAMS((lt_dlhandle handle, lt_ptr_t data)); - lt_ptr_t data; + int (*func) LT_PARAMS((lt_dlhandle handle, lt_ptr data)); + lt_ptr data; { lt_dlhandle cur = handles; @@ -2364,11 +2369,11 @@ lt_dlforeach (func, data) int lt_dlloader_add (place, dlloader, loader_name) - lt_dlloader_t *place; + lt_dlloader *place; const struct lt_user_dlloader *dlloader; const char *loader_name; { - lt_dlloader_t *node = 0, *ptr = 0; + lt_dlloader *node = 0, *ptr = 0; if ((dlloader == 0) /* diagnose null parameters */ || (dlloader->module_open == 0) @@ -2380,7 +2385,7 @@ lt_dlloader_add (place, dlloader, loader } /* Create a new dlloader node with copies of the user callbacks. */ - node = (lt_dlloader_t *) lt_dlmalloc (sizeof (lt_dlloader_t)); + node = (lt_dlloader *) lt_dlmalloc (sizeof (lt_dlloader)); if (node == 0) { last_error = LT_DLSTRERROR (NO_MEMORY); @@ -2443,7 +2448,7 @@ int lt_dlloader_remove (loader_name) const char *loader_name; { - lt_dlloader_t *place = lt_dlloader_find (loader_name); + lt_dlloader *place = lt_dlloader_find (loader_name); lt_dlhandle handle; int result = 0; @@ -2471,7 +2476,7 @@ lt_dlloader_remove (loader_name) else { /* Find the loader before the one being removed. */ - lt_dlloader_t *prev; + lt_dlloader *prev; for (prev = loaders; prev->next; prev = prev->next) { if (!strcmp (prev->next->loader_name, loader_name)) @@ -2497,16 +2502,16 @@ lt_dlloader_remove (loader_name) return result; } -lt_dlloader_t * +lt_dlloader * lt_dlloader_next (place) - lt_dlloader_t *place; + lt_dlloader *place; { return place ? place->next : loaders; } const char * lt_dlloader_name (place) - lt_dlloader_t *place; + lt_dlloader *place; { if (!place) { @@ -2516,9 +2521,9 @@ lt_dlloader_name (place) return place ? place->loader_name : 0; } -lt_dlloader_data_t * +lt_user_data * lt_dlloader_data (place) - lt_dlloader_t *place; + lt_dlloader *place; { if (!place) { @@ -2528,11 +2533,11 @@ lt_dlloader_data (place) return place ? &(place->dlloader_data) : 0; } -lt_dlloader_t * +lt_dlloader * lt_dlloader_find (loader_name) const char *loader_name; { - lt_dlloader_t *place = 0; + lt_dlloader *place = 0; for (place = loaders; place; place = place->next) { Index: libltdl/ltdl.h =================================================================== RCS file: /home/cvs/libtool/libltdl/ltdl.h,v retrieving revision 1.45 diff -u -p -r1.45 ltdl.h --- libltdl/ltdl.h 2000/11/17 18:44:28 1.45 +++ libltdl/ltdl.h 2000/11/17 22:36:17 @@ -38,48 +38,48 @@ Software Foundation, Inc., 59 Temple Pla so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at the end of C declarations. */ #ifdef __cplusplus -# define LTDL_BEGIN_C_DECLS extern "C" { -# define LTDL_END_C_DECLS } +# define LT_BEGIN_C_DECLS extern "C" { +# define LT_END_C_DECLS } #else -# define LTDL_BEGIN_C_DECLS /* empty */ -# define LTDL_END_C_DECLS /* empty */ +# define LT_BEGIN_C_DECLS /* empty */ +# define LT_END_C_DECLS /* empty */ #endif -LTDL_BEGIN_C_DECLS +LT_BEGIN_C_DECLS -/* LTDL_PARAMS is a macro used to wrap function prototypes, so that compilers +/* LT_PARAMS is a macro used to wrap function prototypes, so that compilers that don't understand ANSI C prototypes still work, and ANSI C compilers can issue warnings about type mismatches. */ #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus) -# define LTDL_PARAMS(protos) protos -# define lt_ptr_t void* +# define LT_PARAMS(protos) protos +# define lt_ptr void* #else -# define LTDL_PARAMS(protos) () -# define lt_ptr_t char* +# define LT_PARAMS(protos) () +# define lt_ptr char* #endif -/* LTDL_STMT_START/END are used to create macros which expand to a +/* LT_STMT_START/END are used to create macros which expand to a a single compound statement in a portable way. */ #if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) -# define LTDL_STMT_START (void)( -# define LTDL_STMT_END ) +# define LT_STMT_START (void)( +# define LT_STMT_END ) #else # if (defined (sun) || defined (__sun__)) -# define LTDL_STMT_START if (1) -# define LTDL_STMT_END else (void)0 +# define LT_STMT_START if (1) +# define LT_STMT_END else (void)0 # else -# define LTDL_STMT_START do -# define LTDL_STMT_END while (0) +# define LT_STMT_START do +# define LT_STMT_END while (0) # endif #endif -/* LTDL_CONC creates a new concatenated symbol for the compiler +/* LT_CONC creates a new concatenated symbol for the compiler in a portable way. */ #if defined(__STDC__) || defined(__cplusplus) -# define LTDL_CONC(s,t) s##t +# define LT_CONC(s,t) s##t #else -# define LTDL_CONC(s,t) s/**/t +# define LT_CONC(s,t) s/**/t #endif @@ -108,29 +108,29 @@ LTDL_BEGIN_C_DECLS #ifdef __WINDOWS__ # ifndef __CYGWIN__ -/* LTDL_DIRSEP_CHAR is accepted *in addition* to '/' as a directory +/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory separator when it is set. */ -# define LTDL_DIRSEP_CHAR '\\' -# define LTDL_PATHSEP_CHAR ';' +# define LT_DIRSEP_CHAR '\\' +# define LT_PATHSEP_CHAR ';' # endif #endif -#ifndef LTDL_PATHSEP_CHAR -# define LTDL_PATHSEP_CHAR ':' +#ifndef LT_PATHSEP_CHAR +# define LT_PATHSEP_CHAR ':' #endif /* DLL building support on win32 hosts; mostly to workaround their ridiculous implementation of data symbol exporting. */ -#ifndef LTDL_SCOPE +#ifndef LT_SCOPE # ifdef __WINDOWS__ # ifdef DLL_EXPORT /* defined by libtool (if required) */ -# define LTDL_SCOPE __declspec(dllexport) +# define LT_SCOPE __declspec(dllexport) # endif # ifdef LIBLTDL_DLL_IMPORT /* define if linking with this dll */ -# define LTDL_SCOPE extern __declspec(dllimport) +# define LT_SCOPE extern __declspec(dllimport) # endif # endif -# ifndef LTDL_SCOPE /* static linking or !__WINDOWS__ */ -# define LTDL_SCOPE extern +# ifndef LT_SCOPE /* static linking or !__WINDOWS__ */ +# define LT_SCOPE extern # endif #endif @@ -140,28 +140,28 @@ LTDL_BEGIN_C_DECLS /* --- DYNAMIC MODULE LOADING API --- */ -typedef struct lt_dlhandle_t *lt_dlhandle; /* A loaded module. */ +typedef struct lt_dlhandle *lt_dlhandle; /* A loaded module. */ /* Initialisation and finalisation functions for libltdl. */ -extern int lt_dlinit LTDL_PARAMS((void)); -extern int lt_dlexit LTDL_PARAMS((void)); +extern int lt_dlinit LT_PARAMS((void)); +extern int lt_dlexit LT_PARAMS((void)); /* Module search path manipultation. */ -extern int lt_dladdsearchdir LTDL_PARAMS((const char *search_dir)); -extern int lt_dlsetsearchpath LTDL_PARAMS((const char *search_path)); -extern const char *lt_dlgetsearchpath LTDL_PARAMS((void)); +extern int lt_dladdsearchdir LT_PARAMS((const char *search_dir)); +extern int lt_dlsetsearchpath LT_PARAMS((const char *search_path)); +extern const char *lt_dlgetsearchpath LT_PARAMS((void)); /* Portable libltdl versions of the system dlopen() API. */ -extern lt_dlhandle lt_dlopen LTDL_PARAMS((const char *filename)); -extern lt_dlhandle lt_dlopenext LTDL_PARAMS((const char *filename)); -extern lt_ptr_t lt_dlsym LTDL_PARAMS((lt_dlhandle handle, +extern lt_dlhandle lt_dlopen LT_PARAMS((const char *filename)); +extern lt_dlhandle lt_dlopenext LT_PARAMS((const char *filename)); +extern lt_ptr lt_dlsym LT_PARAMS((lt_dlhandle handle, const char *name)); -extern const char *lt_dlerror LTDL_PARAMS((void)); -extern int lt_dlclose LTDL_PARAMS((lt_dlhandle handle)); +extern const char *lt_dlerror LT_PARAMS((void)); +extern int lt_dlclose LT_PARAMS((lt_dlhandle handle)); /* Pointers to memory management functions to be used by libltdl. */ -LTDL_SCOPE lt_ptr_t (*lt_dlmalloc) LTDL_PARAMS((size_t size)); -LTDL_SCOPE void (*lt_dlfree) LTDL_PARAMS((lt_ptr_t ptr)); +LT_SCOPE lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size)); +LT_SCOPE void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)); @@ -173,17 +173,17 @@ LTDL_SCOPE void (*lt_dlfree) LTDL_PA symbols for a dlpreopened module. */ typedef struct { const char *name; - lt_ptr_t address; + lt_ptr address; } lt_dlsymlist; -extern int lt_dlpreload LTDL_PARAMS((const lt_dlsymlist *preloaded)); +extern int lt_dlpreload LT_PARAMS((const lt_dlsymlist *preloaded)); extern int lt_dlpreload_default - LTDL_PARAMS((const lt_dlsymlist *preloaded)); + LT_PARAMS((const lt_dlsymlist *preloaded)); -#define LTDL_SET_PRELOADED_SYMBOLS() LTDL_STMT_START{ \ +#define LTDL_SET_PRELOADED_SYMBOLS() LT_STMT_START{ \ extern const lt_dlsymlist lt_preloaded_symbols[]; \ lt_dlpreload_default(lt_preloaded_symbols); \ - }LTDL_STMT_END + }LT_STMT_END @@ -199,10 +199,10 @@ typedef struct { number of times lt_dlclosed. */ } lt_dlinfo; -extern const lt_dlinfo *lt_dlgetinfo LTDL_PARAMS((lt_dlhandle handle)); -extern int lt_dlforeach LTDL_PARAMS(( - int (*func)(lt_dlhandle handle, lt_ptr_t data), - lt_ptr_t data)); +extern const lt_dlinfo *lt_dlgetinfo LT_PARAMS((lt_dlhandle handle)); +extern int lt_dlforeach LT_PARAMS(( + int (*func) (lt_dlhandle handle, lt_ptr data), + lt_ptr data)); @@ -210,46 +210,38 @@ extern int lt_dlforeach LTDL_PARAM /* --- USER MODULE LOADER API --- */ -typedef struct lt_dlloader_t lt_dlloader_t; -typedef lt_ptr_t lt_dlloader_data_t; -typedef lt_ptr_t lt_module_t; +typedef struct lt_dlloader lt_dlloader; +typedef lt_ptr lt_user_data; +typedef lt_ptr lt_module; /* Function pointer types for creating user defined module loaders. */ -typedef lt_module_t lt_module_open_t LTDL_PARAMS(( - lt_dlloader_data_t loader_data, +typedef lt_module lt_module_open LT_PARAMS((lt_user_data loader_data, const char *filename)); -typedef int lt_module_close_t LTDL_PARAMS(( - lt_dlloader_data_t loader_data, - lt_module_t handle)); -typedef lt_ptr_t lt_find_sym_t LTDL_PARAMS(( - lt_dlloader_data_t loader_data, - lt_module_t handle, +typedef int lt_module_close LT_PARAMS((lt_user_data loader_data, + lt_module handle)); +typedef lt_ptr lt_find_sym LT_PARAMS((lt_user_data loader_data, + lt_module handle, const char *symbol)); -typedef int lt_dlloader_exit_t LTDL_PARAMS(( - lt_dlloader_data_t loader_data)); +typedef int lt_dlloader_exit LT_PARAMS((lt_user_data loader_data)); struct lt_user_dlloader { const char *sym_prefix; - lt_module_open_t *module_open; - lt_module_close_t *module_close; - lt_find_sym_t *find_sym; - lt_dlloader_exit_t *dlloader_exit; - lt_dlloader_data_t dlloader_data; + lt_module_open *module_open; + lt_module_close *module_close; + lt_find_sym *find_sym; + lt_dlloader_exit *dlloader_exit; + lt_user_data dlloader_data; }; -extern lt_dlloader_t *lt_dlloader_next LTDL_PARAMS(( - lt_dlloader_t *place)); -extern lt_dlloader_t *lt_dlloader_find LTDL_PARAMS(( +extern lt_dlloader *lt_dlloader_next LT_PARAMS((lt_dlloader *place)); +extern lt_dlloader *lt_dlloader_find LT_PARAMS(( const char *loader_name)); -extern const char *lt_dlloader_name LTDL_PARAMS(( - lt_dlloader_t *place)); -extern lt_dlloader_data_t *lt_dlloader_data LTDL_PARAMS(( - lt_dlloader_t *place)); -extern int lt_dlloader_add LTDL_PARAMS(( - lt_dlloader_t *place, +extern const char *lt_dlloader_name LT_PARAMS((lt_dlloader *place)); +extern lt_user_data *lt_dlloader_data LT_PARAMS((lt_dlloader *place)); +extern int lt_dlloader_add LT_PARAMS((lt_dlloader *place, const struct lt_user_dlloader *dlloader, const char *loader_name)); -extern int lt_dlloader_remove LTDL_PARAMS(( +extern int lt_dlloader_remove LT_PARAMS(( const char *loader_name)); @@ -261,37 +253,52 @@ extern int lt_dlloader_remove LTDL_PAR this way allows us to expand the macro in different contexts with confidence that the enumeration of symbolic names will map correctly onto the table of error strings. */ -#define ltdl_error_table \ - LTDL_ERROR(UNKNOWN, "unknown error") \ - LTDL_ERROR(DLOPEN_NOT_SUPPORTED,"dlopen support not available") \ - LTDL_ERROR(INVALID_LOADER, "invalid loader") \ - LTDL_ERROR(INIT_LOADER, "loader initialization failed") \ - LTDL_ERROR(REMOVE_LOADER, "loader removal failed") \ - LTDL_ERROR(FILE_NOT_FOUND, "file not found") \ - LTDL_ERROR(DEPLIB_NOT_FOUND, "dependency library not found") \ - LTDL_ERROR(NO_SYMBOLS, "no symbols defined") \ - LTDL_ERROR(CANNOT_OPEN, "can't open the module") \ - LTDL_ERROR(CANNOT_CLOSE, "can't close the module") \ - LTDL_ERROR(SYMBOL_NOT_FOUND, "symbol not found") \ - LTDL_ERROR(NO_MEMORY, "not enough memory") \ - LTDL_ERROR(INVALID_HANDLE, "invalid module handle") \ - LTDL_ERROR(BUFFER_OVERFLOW, "internal buffer overflow") \ - LTDL_ERROR(INVALID_ERRORCODE, "invalid errorcode") \ - LTDL_ERROR(SHUTDOWN, "library already shutdown") +#define lt_dlerror_table \ + LT_ERROR(UNKNOWN, "unknown error") \ + LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available") \ + LT_ERROR(INVALID_LOADER, "invalid loader") \ + LT_ERROR(INIT_LOADER, "loader initialization failed") \ + LT_ERROR(REMOVE_LOADER, "loader removal failed") \ + LT_ERROR(FILE_NOT_FOUND, "file not found") \ + LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found") \ + LT_ERROR(NO_SYMBOLS, "no symbols defined") \ + LT_ERROR(CANNOT_OPEN, "can't open the module") \ + LT_ERROR(CANNOT_CLOSE, "can't close the module") \ + LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found") \ + LT_ERROR(NO_MEMORY, "not enough memory") \ + LT_ERROR(INVALID_HANDLE, "invalid module handle") \ + LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow") \ + LT_ERROR(INVALID_ERRORCODE, "invalid errorcode") \ + LT_ERROR(SHUTDOWN, "library already shutdown") /* Enumerate the symbolic error names. */ enum { -#define LTDL_ERROR(name, diagnostic) LTDL_CONC(LTDL_ERROR_, name), - ltdl_error_table -#undef LTDL_ERROR +#define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name), + lt_dlerror_table +#undef LT_ERROR - LTDL_ERROR_MAX + LT_ERROR_MAX }; /* These functions are only useful from inside custom module loaders. */ -extern int lt_dladderror LTDL_PARAMS((const char *diagnostic)); -extern int lt_dlseterror LTDL_PARAMS((int errorcode)); +extern int lt_dladderror LT_PARAMS((const char *diagnostic)); +extern int lt_dlseterror LT_PARAMS((int errorcode)); -LTDL_END_C_DECLS +#ifndef LT_POSIX_NAMESPACE +# define LT_FUBAR_NAMESPACE +#endif + +#ifdef LT_FUBAR_NAMESPACE +# define lt_ptr_t lt_ptr +# define lt_module_t lt_module +# define lt_module_open_t lt_module_open +# define lt_module_close_t lt_module_close +# define lt_find_sym_t lt_find_sym +# define lt_dlloader_exit_t lt_dlloader_exit +# define lt_dlloader_t lt_dlloader +# define lt_dlloader_data_t lt_user_data +#endif + +LT_END_C_DECLS #endif /* !LTDL_H */