(LBAPR-1) load mod_lua with global symbols space so that sub modules are able to link to it properly. Broken in svn r9605.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10306 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2008-11-08 11:21:54 +00:00
parent bd79896c21
commit d3e7370885
4 changed files with 34 additions and 10 deletions
+19 -4
View File
@@ -691,6 +691,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
char *derr = NULL;
const char *err = NULL;
switch_memory_pool_t *pool;
switch_bool_t load_global = global;
switch_assert(path != NULL);
@@ -700,11 +701,11 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
struct_name = switch_core_sprintf(pool, "%s_module_interface", filename);
#ifdef WIN32
dso = switch_dso_open("FreeSwitch.dll", global, &derr);
dso = switch_dso_open("FreeSwitch.dll", load_global, &derr);
#elif defined (MACOSX) || defined(DARWIN)
dso = switch_dso_open(SWITCH_PREFIX_DIR "/lib/libfreeswitch.dylib", global, &derr);
dso = switch_dso_open(SWITCH_PREFIX_DIR "/lib/libfreeswitch.dylib", load_global, &derr);
#else
dso = switch_dso_open(NULL, global, &derr);
dso = switch_dso_open(NULL, load_global, &derr);
#endif
if (!derr && dso) {
interface_struct_handle = switch_dso_data_sym(dso, struct_name, &derr);
@@ -713,7 +714,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
switch_safe_free(derr)
if (!interface_struct_handle) {
dso = switch_dso_open(path, global, &derr);
dso = switch_dso_open(path, load_global, &derr);
}
while (loading) {
@@ -731,6 +732,20 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
break;
}
if (interface_struct_handle && interface_struct_handle->switch_api_version != SWITCH_API_VERSION) {
err = "Trying to load an out of date module, please rebuild the module.";
break;
}
if (!load_global && interface_struct_handle && switch_test_flag(interface_struct_handle, SMODF_GLOBAL_SYMBOLS)) {
load_global = SWITCH_TRUE;
switch_dso_destroy(&dso);
interface_struct_handle = NULL;
dso = switch_dso_open(path, load_global, &derr);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading module with global namespace at request of module\n");
continue;
}
if (interface_struct_handle) {
mod_interface_functions = interface_struct_handle;
load_func_ptr = mod_interface_functions->load;