*/
#if HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#if HAVE_STDIO_H
#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
/* 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
\f
/* --- 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
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;
\f
/* 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
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;
#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 ()
# 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)
{
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)
{
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)
{
# 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)
{
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)
{
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)
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 */
/* 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)
{
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)
{
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)
{
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__ */
#include <kernel/image.h>
-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;
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)
{
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)
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__ */
#include <dld.h>
#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)
{
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)
{
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)
{
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 */
static int
presym_init (loader_data)
- lt_dlloader_data_t loader_data;
+ lt_user_data loader_data;
{
preloaded_symbols = 0;
}
static int
-presym_free_symlists LTDL_PARAMS((void))
+presym_free_symlists ()
{
lt_dlsymlists_t *lists = preloaded_symbols;
static int
presym_exit (loader_data)
- lt_dlloader_data_t loader_data;
+ lt_user_data loader_data;
{
presym_free_symlists ();
return 0;
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;
{
if (!syms->address && strcmp(syms->name, filename) == 0)
{
- return (lt_module_t) syms;
+ return (lt_module) syms;
}
++syms;
}
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;
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
+};
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;
lt_dlexit ()
{
/* shut down libltdl */
- lt_dlloader_t *loader = loaders;
+ lt_dlloader *loader = loaders;
int errors = 0;
if (!initialized)
/* 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;
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 */
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)
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++ = '/';
}
return canonical;
}
-static lt_ptr_t
+static lt_ptr
find_file (basename, search_path, pdir, handle)
const char *basename;
const char *search_path;
/* 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;
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;
}
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)
filename = 0;
}
- result = (lt_ptr_t) file;
+ result = (lt_ptr) file;
goto cleanup;
}
}
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;
}
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);
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;
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);
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);
goto cleanup;
}
- line = (char*) lt_dlmalloc (LTDL_FILENAME_MAX);
+ line = (char*) lt_dlmalloc (LT_FILENAME_MAX);
if (!line)
{
fclose (file);
/* read the .la file */
while (!feof(file))
{
- if (!fgets (line, LTDL_FILENAME_MAX, file))
+ if (!fgets (line, LT_FILENAME_MAX, file))
{
break;
}
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)
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);
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)
{
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)
{
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)
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);
}
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;
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;
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)
}
/* 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);
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;
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))
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)
{
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)
{
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)
{
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
#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
/* --- 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));
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
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));
/* --- 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));
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 */