lib dllload,loadbind,shl_load -ldl
extern struct link_dynamic _DYNAMIC;
then for s in "*.*" "*[!a]*"
i=`echo $lib | sed 's,\([^0-9]*[0-9]*\).*,\1,'`
# some run time linkers barf with
/lib/xxx if
then lib=`echo $lib | sed 's,
/usr/lib/,,'`
echo "#define _DLL_NEXT_PATH \"$lib\""
#if defined(__MVS__) && !defined(__SUSV3)
#if _hdr_dlfcn && _lib_dlopen
static char* local[] = { "__elf_header", "_call_add_gp_range", "_etext" };
printf("#if defined(__MVS__) && !defined(__SUSV3)\n");
printf("#define __SUSV3 1\n");
#if _hdr_dlfcn && _lib_dlopen
printf("#define RTLD_LAZY 1\n");
printf("#define RTLD_NOW 2\n");
printf("#define RTLD_GLOBAL 0\n");
printf("#define RTLD_LOCAL 0\n");
printf("#define RTLD_PARENT 0\n");
#if defined(_hdr_mach_o_dyld) && !defined(RTLD_NEXT)
printf("#define RTLD_NEXT ((void*)16)\n");
if (!(dll = dlopen(0, RTLD_LAZY)))
for (i = 0; i < sizeof(local) / sizeof(local[0]); i++)
if (dlsym(dll, local[i]))
if (i >= sizeof(local) / sizeof(local[0]))
printf("#define _DLL_RLD_SYM %s\n", local[i]);
printf("#define _DLL_RLD_SYM_STR \"%s\"\n", local[i]);
printf("#define _DLL_RLD_SYM_TYPE void*\n");
printf("#define DLL_INFO_PREVER 0x0001 /* pre-suffix style version */\n");
printf("#define DLL_INFO_DOTVER 0x0002 /* post-suffix style version */\n");
printf("typedef unsigned long (*Dll_plugin_version_f)(void);\n");
printf("typedef struct Dllinfo_s\n");
printf(" char** sibling; /* sibling dirs on $PATH */\n");
printf(" char* prefix; /* library name prefix */\n");
printf(" char* suffix; /* library name suffix */\n");
printf(" char* env; /* library path env var */\n");
printf(" int flags; /* DLL_INFO_* flags */\n");
printf("#ifdef _DLLINFO_PRIVATE_\n");
printf(" _DLLINFO_PRIVATE_\n");
printf("} Dllinfo_t;\n");
printf("typedef struct Dllent_s\n");
printf(" char* path;\n");
printf(" char* name;\n");
printf("#ifdef _DLLENT_PRIVATE_\n");
printf(" _DLLENT_PRIVATE_\n");
printf("typedef struct Dllscan_s\n");
printf("#ifdef _DLLSCAN_PRIVATE_\n");
printf(" _DLLSCAN_PRIVATE_\n");
printf("} Dllscan_t;\n");
#if !_hdr_dlfcn || !_lib_dlopen
printf("extern void* dlopen(const char*, int);\n");
printf("extern void* dlsym(void*, const char*);\n");
printf("extern int dlclose(void*);\n");
printf("extern char* dlerror(void);\n");
printf("#if _BLD_dll && defined(__EXPORT__)\n");
printf("#define extern __EXPORT__\n");
printf("extern Dllinfo_t* dllinfo(void);\n");
printf("extern void* dllplugin(const char*, const char*, const char*, unsigned long, unsigned long*, int, char*, size_t);\n");
printf("extern void* dllplug(const char*, const char*, const char*, int, char*, size_t);\n");
printf("extern void* dllfind(const char*, const char*, int, char*, size_t);\n");
printf("extern void* dllopen(const char*, int);\n");
printf("extern void* dllnext(int);\n");
printf("extern void* dlllook(void*, const char*);\n");
printf("extern int dllcheck(void*, const char*, unsigned long, unsigned long*);\n");
printf("extern unsigned long dllversion(void*, const char*);\n");
printf("extern char* dllerror(int);\n");
printf("extern void* _dll_next(int, _DLL_RLD_SYM_TYPE*);\n");
printf("#define dllnext(f) _dll_next(f, &_DLL_RLD_SYM)\n");
printf("extern Dllscan_t* dllsopen(const char*, const char*, const char*);\n");
printf("extern Dllent_t* dllsread(Dllscan_t*);\n");
printf("extern int dllsclose(Dllscan_t*);\n");
printf("#undef extern\n");
printf("extern _DLL_RLD_SYM_TYPE _DLL_RLD_SYM;\n");