add our own module load code (LBAPR-1)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10272 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2008-11-06 17:29:50 +00:00
parent 837b2c9bed
commit b17ebda4df
5 changed files with 69 additions and 42 deletions

View File

@@ -54,9 +54,19 @@ switch_dso_func_t switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, cha
DWORD error = GetLastError();
*err = switch_mprintf("dll sym error [%ul]\n", error);
}
return func;
return (switch_dso_func_t)func;
}
void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
FARPROC addr = GetProcAddress(lib, sym);
if (!addr) {
DWORD error = GetLastError();
*err = switch_mprintf("dll sym error [%ul]\n", error);
}
return (void *)(intptr_t)addr;
}
#else
/*
** {========================================================================
@@ -92,13 +102,22 @@ switch_dso_lib_t switch_dso_open(const char *path, int global, char **err) {
return lib;
}
void *switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
switch_dso_func_t switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
void *func = dlsym(lib, sym);
if (!func) {
*err = strdup(dlerror());
}
return func;
return (switch_dso_func_t)(intptr_t)func;
}
void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
void *addr = dlsym(lib, sym);
if (!addr) {
*err = strdup(dlerror());
}
return addr;
}
#endif
/* }====================================================== */