39 lib = LoadLibraryEx(path, NULL, 0);
42 lib = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
46 lib = LoadLibraryEx(path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
50 DWORD
error = GetLastError();
59 FARPROC func = GetProcAddress(lib, sym);
61 DWORD
error = GetLastError();
69 FARPROC addr = GetProcAddress(lib, sym);
71 DWORD
error = GetLastError();
74 return (
void *) (intptr_t) addr;
94 #ifndef HAVE_FAKE_DLCLOSE 106 lib = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
108 lib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
112 const char *dlerr = dlerror();
115 *err = strdup(dlerr);
117 *err = strdup(
"Unknown error");
125 void *func = dlsym(lib, sym);
127 *err = strdup(dlerror());
134 void *addr = dlsym(lib, sym);
136 char *err_str = NULL;
139 if (!(addr = dlsym(lib, sym))) {
140 err_str = (
char *)dlerror();
144 *err = strdup(err_str);
switch_dso_lib_t switch_dso_open(const char *path, int global, char **err)
void switch_dso_destroy(switch_dso_lib_t *lib)
switch_dso_func_t switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err)
void * switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err)
SWITCH_BEGIN_EXTERN_C typedef int(* switch_dso_func_t)(void)
const char *const const char *const path
SWITCH_BEGIN_EXTERN_C char * switch_mprintf(const char *zFormat,...)