|
@@ -34,45 +34,45 @@ static const string dll_ext = ".so";
|
|
|
|
|
|
|
|
static const string default_plugin_filename = "p3d_plugin";
|
|
static const string default_plugin_filename = "p3d_plugin";
|
|
|
|
|
|
|
|
-P3D_initialize_func *P3D_initialize;
|
|
|
|
|
-P3D_finalize_func *P3D_finalize;
|
|
|
|
|
-P3D_set_plugin_version_func *P3D_set_plugin_version;
|
|
|
|
|
-P3D_set_super_mirror_func *P3D_set_super_mirror;
|
|
|
|
|
-P3D_new_instance_func *P3D_new_instance;
|
|
|
|
|
-P3D_instance_start_func *P3D_instance_start;
|
|
|
|
|
-P3D_instance_start_stream_func *P3D_instance_start_stream;
|
|
|
|
|
-P3D_instance_finish_func *P3D_instance_finish;
|
|
|
|
|
-P3D_instance_setup_window_func *P3D_instance_setup_window;
|
|
|
|
|
-
|
|
|
|
|
-P3D_object_get_type_func *P3D_object_get_type;
|
|
|
|
|
-P3D_object_get_bool_func *P3D_object_get_bool;
|
|
|
|
|
-P3D_object_get_int_func *P3D_object_get_int;
|
|
|
|
|
-P3D_object_get_float_func *P3D_object_get_float;
|
|
|
|
|
-P3D_object_get_string_func *P3D_object_get_string;
|
|
|
|
|
-P3D_object_get_repr_func *P3D_object_get_repr;
|
|
|
|
|
-P3D_object_get_property_func *P3D_object_get_property;
|
|
|
|
|
-P3D_object_set_property_func *P3D_object_set_property;
|
|
|
|
|
-P3D_object_has_method_func *P3D_object_has_method;
|
|
|
|
|
-P3D_object_call_func *P3D_object_call;
|
|
|
|
|
-P3D_object_eval_func *P3D_object_eval;
|
|
|
|
|
-P3D_object_incref_func *P3D_object_incref;
|
|
|
|
|
-P3D_object_decref_func *P3D_object_decref;
|
|
|
|
|
-
|
|
|
|
|
-P3D_make_class_definition_func *P3D_make_class_definition;
|
|
|
|
|
-P3D_new_undefined_object_func *P3D_new_undefined_object;
|
|
|
|
|
-P3D_new_none_object_func *P3D_new_none_object;
|
|
|
|
|
-P3D_new_bool_object_func *P3D_new_bool_object;
|
|
|
|
|
-P3D_new_int_object_func *P3D_new_int_object;
|
|
|
|
|
-P3D_new_float_object_func *P3D_new_float_object;
|
|
|
|
|
-P3D_new_string_object_func *P3D_new_string_object;
|
|
|
|
|
-P3D_instance_get_panda_script_object_func *P3D_instance_get_panda_script_object;
|
|
|
|
|
-P3D_instance_set_browser_script_object_func *P3D_instance_set_browser_script_object;
|
|
|
|
|
-
|
|
|
|
|
-P3D_instance_get_request_func *P3D_instance_get_request;
|
|
|
|
|
-P3D_check_request_func *P3D_check_request;
|
|
|
|
|
-P3D_request_finish_func *P3D_request_finish;
|
|
|
|
|
-P3D_instance_feed_url_stream_func *P3D_instance_feed_url_stream;
|
|
|
|
|
-P3D_instance_handle_event_func *P3D_instance_handle_event;
|
|
|
|
|
|
|
+P3D_initialize_func *P3D_initialize_ptr;
|
|
|
|
|
+P3D_finalize_func *P3D_finalize_ptr;
|
|
|
|
|
+P3D_set_plugin_version_func *P3D_set_plugin_version_ptr;
|
|
|
|
|
+P3D_set_super_mirror_func *P3D_set_super_mirror_ptr;
|
|
|
|
|
+P3D_new_instance_func *P3D_new_instance_ptr;
|
|
|
|
|
+P3D_instance_start_func *P3D_instance_start_ptr;
|
|
|
|
|
+P3D_instance_start_stream_func *P3D_instance_start_stream_ptr;
|
|
|
|
|
+P3D_instance_finish_func *P3D_instance_finish_ptr;
|
|
|
|
|
+P3D_instance_setup_window_func *P3D_instance_setup_window_ptr;
|
|
|
|
|
+
|
|
|
|
|
+P3D_object_get_type_func *P3D_object_get_type_ptr;
|
|
|
|
|
+P3D_object_get_bool_func *P3D_object_get_bool_ptr;
|
|
|
|
|
+P3D_object_get_int_func *P3D_object_get_int_ptr;
|
|
|
|
|
+P3D_object_get_float_func *P3D_object_get_float_ptr;
|
|
|
|
|
+P3D_object_get_string_func *P3D_object_get_string_ptr;
|
|
|
|
|
+P3D_object_get_repr_func *P3D_object_get_repr_ptr;
|
|
|
|
|
+P3D_object_get_property_func *P3D_object_get_property_ptr;
|
|
|
|
|
+P3D_object_set_property_func *P3D_object_set_property_ptr;
|
|
|
|
|
+P3D_object_has_method_func *P3D_object_has_method_ptr;
|
|
|
|
|
+P3D_object_call_func *P3D_object_call_ptr;
|
|
|
|
|
+P3D_object_eval_func *P3D_object_eval_ptr;
|
|
|
|
|
+P3D_object_incref_func *P3D_object_incref_ptr;
|
|
|
|
|
+P3D_object_decref_func *P3D_object_decref_ptr;
|
|
|
|
|
+
|
|
|
|
|
+P3D_make_class_definition_func *P3D_make_class_definition_ptr;
|
|
|
|
|
+P3D_new_undefined_object_func *P3D_new_undefined_object_ptr;
|
|
|
|
|
+P3D_new_none_object_func *P3D_new_none_object_ptr;
|
|
|
|
|
+P3D_new_bool_object_func *P3D_new_bool_object_ptr;
|
|
|
|
|
+P3D_new_int_object_func *P3D_new_int_object_ptr;
|
|
|
|
|
+P3D_new_float_object_func *P3D_new_float_object_ptr;
|
|
|
|
|
+P3D_new_string_object_func *P3D_new_string_object_ptr;
|
|
|
|
|
+P3D_instance_get_panda_script_object_func *P3D_instance_get_panda_script_object_ptr;
|
|
|
|
|
+P3D_instance_set_browser_script_object_func *P3D_instance_set_browser_script_object_ptr;
|
|
|
|
|
+
|
|
|
|
|
+P3D_instance_get_request_func *P3D_instance_get_request_ptr;
|
|
|
|
|
+P3D_check_request_func *P3D_check_request_ptr;
|
|
|
|
|
+P3D_request_finish_func *P3D_request_finish_ptr;
|
|
|
|
|
+P3D_instance_feed_url_stream_func *P3D_instance_feed_url_stream_ptr;
|
|
|
|
|
+P3D_instance_handle_event_func *P3D_instance_handle_event_ptr;
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
|
static HMODULE module = NULL;
|
|
static HMODULE module = NULL;
|
|
@@ -81,6 +81,7 @@ static void *module = NULL;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
static bool plugin_loaded = false;
|
|
static bool plugin_loaded = false;
|
|
|
|
|
+static bool dso_needs_unload = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -122,8 +123,14 @@ static void unload_dso();
|
|
|
// Function: load_plugin
|
|
// Function: load_plugin
|
|
|
// Description: Loads the plugin and assigns all of the function
|
|
// Description: Loads the plugin and assigns all of the function
|
|
|
// pointers. Returns true on success, false on failure.
|
|
// pointers. Returns true on success, false on failure.
|
|
|
-// If the filename is empty, it is searched along the
|
|
|
|
|
-// path.
|
|
|
|
|
|
|
+// If load_plugin() has already been called
|
|
|
|
|
+// successfully, this returns true immediately, without
|
|
|
|
|
+// parsing any parameters.
|
|
|
|
|
+//
|
|
|
|
|
+// If p3d_plugin_filename is empty, the module is
|
|
|
|
|
+// assumed to be already loaded (or statically linked
|
|
|
|
|
+// in), and the symbols are located within the current
|
|
|
|
|
+// address space.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
bool
|
|
bool
|
|
|
load_plugin(const string &p3d_plugin_filename,
|
|
load_plugin(const string &p3d_plugin_filename,
|
|
@@ -131,33 +138,39 @@ load_plugin(const string &p3d_plugin_filename,
|
|
|
bool verify_contents, const string &platform,
|
|
bool verify_contents, const string &platform,
|
|
|
const string &log_directory, const string &log_basename,
|
|
const string &log_directory, const string &log_basename,
|
|
|
bool trusted_environment, bool console_environment,
|
|
bool trusted_environment, bool console_environment,
|
|
|
- ostream &logfile) {
|
|
|
|
|
- string filename = p3d_plugin_filename;
|
|
|
|
|
- if (filename.empty()) {
|
|
|
|
|
- // Look for the plugin along the path.
|
|
|
|
|
- filename = get_plugin_basename();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const string &root_dir, ostream &logfile) {
|
|
|
if (plugin_loaded) {
|
|
if (plugin_loaded) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
+ string filename = p3d_plugin_filename;
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
|
assert(module == NULL);
|
|
assert(module == NULL);
|
|
|
-
|
|
|
|
|
- // On Windows, the filename passed to LoadLibrary() must have an
|
|
|
|
|
- // extension, or a default ".DLL" will be implicitly added. If the
|
|
|
|
|
- // file actually has no extension, we must add "." to avoid this.
|
|
|
|
|
-
|
|
|
|
|
- // Check whether the filename has an extension.
|
|
|
|
|
- size_t extension_dot = find_extension_dot(filename);
|
|
|
|
|
- if (extension_dot == string::npos) {
|
|
|
|
|
- // No extension.
|
|
|
|
|
- filename += ".";
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (filename.empty()) {
|
|
|
|
|
+ // If no filename is supplied, look within our existing address space.
|
|
|
|
|
+ module = GetModuleHandle(NULL);
|
|
|
|
|
+ dso_needs_unload = false;
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // If a filename is supplied, attempt to load it as a dynamic library.
|
|
|
|
|
+
|
|
|
|
|
+ // On Windows, the filename passed to LoadLibrary() must have an
|
|
|
|
|
+ // extension, or a default ".DLL" will be implicitly added. If the
|
|
|
|
|
+ // file actually has no extension, we must add "." to avoid this.
|
|
|
|
|
+
|
|
|
|
|
+ // Check whether the filename has an extension.
|
|
|
|
|
+ size_t extension_dot = find_extension_dot(filename);
|
|
|
|
|
+ if (extension_dot == string::npos) {
|
|
|
|
|
+ // No extension.
|
|
|
|
|
+ filename += ".";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SetErrorMode(0);
|
|
|
|
|
+ module = LoadLibrary(filename.c_str());
|
|
|
|
|
+ dso_needs_unload = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- SetErrorMode(0);
|
|
|
|
|
- module = LoadLibrary(filename.c_str());
|
|
|
|
|
if (module == NULL) {
|
|
if (module == NULL) {
|
|
|
// Couldn't load the DLL.
|
|
// Couldn't load the DLL.
|
|
|
logfile
|
|
logfile
|
|
@@ -171,7 +184,11 @@ load_plugin(const string &p3d_plugin_filename,
|
|
|
#else // _WIN32
|
|
#else // _WIN32
|
|
|
// Posix case.
|
|
// Posix case.
|
|
|
assert(module == NULL);
|
|
assert(module == NULL);
|
|
|
- module = dlopen(filename.c_str(), RTLD_LAZY | RTLD_LOCAL);
|
|
|
|
|
|
|
+ if (filename.empty()) {
|
|
|
|
|
+ module = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ module = dlopen(filename.c_str(), RTLD_LAZY | RTLD_LOCAL);
|
|
|
|
|
+ }
|
|
|
if (module == NULL) {
|
|
if (module == NULL) {
|
|
|
// Couldn't load the .so.
|
|
// Couldn't load the .so.
|
|
|
const char *message = dlerror();
|
|
const char *message = dlerror();
|
|
@@ -182,135 +199,136 @@ load_plugin(const string &p3d_plugin_filename,
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+ dso_needs_unload = true;
|
|
|
|
|
|
|
|
#define get_func dlsym
|
|
#define get_func dlsym
|
|
|
|
|
|
|
|
#endif // _WIN32
|
|
#endif // _WIN32
|
|
|
|
|
|
|
|
// Now get all of the function pointers.
|
|
// Now get all of the function pointers.
|
|
|
- P3D_initialize = (P3D_initialize_func *)get_func(module, "P3D_initialize");
|
|
|
|
|
- P3D_finalize = (P3D_finalize_func *)get_func(module, "P3D_finalize");
|
|
|
|
|
- P3D_set_plugin_version = (P3D_set_plugin_version_func *)get_func(module, "P3D_set_plugin_version");
|
|
|
|
|
- P3D_set_super_mirror = (P3D_set_super_mirror_func *)get_func(module, "P3D_set_super_mirror");
|
|
|
|
|
- P3D_new_instance = (P3D_new_instance_func *)get_func(module, "P3D_new_instance");
|
|
|
|
|
- P3D_instance_start = (P3D_instance_start_func *)get_func(module, "P3D_instance_start");
|
|
|
|
|
- P3D_instance_start_stream = (P3D_instance_start_stream_func *)get_func(module, "P3D_instance_start_stream");
|
|
|
|
|
- P3D_instance_finish = (P3D_instance_finish_func *)get_func(module, "P3D_instance_finish");
|
|
|
|
|
- P3D_instance_setup_window = (P3D_instance_setup_window_func *)get_func(module, "P3D_instance_setup_window");
|
|
|
|
|
-
|
|
|
|
|
- P3D_object_get_type = (P3D_object_get_type_func *)get_func(module, "P3D_object_get_type");
|
|
|
|
|
- P3D_object_get_bool = (P3D_object_get_bool_func *)get_func(module, "P3D_object_get_bool");
|
|
|
|
|
- P3D_object_get_int = (P3D_object_get_int_func *)get_func(module, "P3D_object_get_int");
|
|
|
|
|
- P3D_object_get_float = (P3D_object_get_float_func *)get_func(module, "P3D_object_get_float");
|
|
|
|
|
- P3D_object_get_string = (P3D_object_get_string_func *)get_func(module, "P3D_object_get_string");
|
|
|
|
|
- P3D_object_get_repr = (P3D_object_get_repr_func *)get_func(module, "P3D_object_get_repr");
|
|
|
|
|
- P3D_object_get_property = (P3D_object_get_property_func *)get_func(module, "P3D_object_get_property");
|
|
|
|
|
- P3D_object_set_property = (P3D_object_set_property_func *)get_func(module, "P3D_object_set_property");
|
|
|
|
|
- P3D_object_has_method = (P3D_object_has_method_func *)get_func(module, "P3D_object_has_method");
|
|
|
|
|
- P3D_object_call = (P3D_object_call_func *)get_func(module, "P3D_object_call");
|
|
|
|
|
- P3D_object_eval = (P3D_object_eval_func *)get_func(module, "P3D_object_eval");
|
|
|
|
|
- P3D_object_incref = (P3D_object_incref_func *)get_func(module, "P3D_object_incref");
|
|
|
|
|
- P3D_object_decref = (P3D_object_decref_func *)get_func(module, "P3D_object_decref");
|
|
|
|
|
- P3D_make_class_definition = (P3D_make_class_definition_func *)get_func(module, "P3D_make_class_definition");
|
|
|
|
|
- P3D_new_undefined_object = (P3D_new_undefined_object_func *)get_func(module, "P3D_new_undefined_object");
|
|
|
|
|
- P3D_new_none_object = (P3D_new_none_object_func *)get_func(module, "P3D_new_none_object");
|
|
|
|
|
- P3D_new_bool_object = (P3D_new_bool_object_func *)get_func(module, "P3D_new_bool_object");
|
|
|
|
|
- P3D_new_int_object = (P3D_new_int_object_func *)get_func(module, "P3D_new_int_object");
|
|
|
|
|
- P3D_new_float_object = (P3D_new_float_object_func *)get_func(module, "P3D_new_float_object");
|
|
|
|
|
- P3D_new_string_object = (P3D_new_string_object_func *)get_func(module, "P3D_new_string_object");
|
|
|
|
|
- P3D_instance_get_panda_script_object = (P3D_instance_get_panda_script_object_func *)get_func(module, "P3D_instance_get_panda_script_object");
|
|
|
|
|
- P3D_instance_set_browser_script_object = (P3D_instance_set_browser_script_object_func *)get_func(module, "P3D_instance_set_browser_script_object");
|
|
|
|
|
-
|
|
|
|
|
- P3D_instance_get_request = (P3D_instance_get_request_func *)get_func(module, "P3D_instance_get_request");
|
|
|
|
|
- P3D_check_request = (P3D_check_request_func *)get_func(module, "P3D_check_request");
|
|
|
|
|
- P3D_request_finish = (P3D_request_finish_func *)get_func(module, "P3D_request_finish");
|
|
|
|
|
- P3D_instance_feed_url_stream = (P3D_instance_feed_url_stream_func *)get_func(module, "P3D_instance_feed_url_stream");
|
|
|
|
|
- P3D_instance_handle_event = (P3D_instance_handle_event_func *)get_func(module, "P3D_instance_handle_event");
|
|
|
|
|
|
|
+ P3D_initialize_ptr = (P3D_initialize_func *)get_func(module, "P3D_initialize");
|
|
|
|
|
+ P3D_finalize_ptr = (P3D_finalize_func *)get_func(module, "P3D_finalize");
|
|
|
|
|
+ P3D_set_plugin_version_ptr = (P3D_set_plugin_version_func *)get_func(module, "P3D_set_plugin_version");
|
|
|
|
|
+ P3D_set_super_mirror_ptr = (P3D_set_super_mirror_func *)get_func(module, "P3D_set_super_mirror");
|
|
|
|
|
+ P3D_new_instance_ptr = (P3D_new_instance_func *)get_func(module, "P3D_new_instance");
|
|
|
|
|
+ P3D_instance_start_ptr = (P3D_instance_start_func *)get_func(module, "P3D_instance_start");
|
|
|
|
|
+ P3D_instance_start_stream_ptr = (P3D_instance_start_stream_func *)get_func(module, "P3D_instance_start_stream");
|
|
|
|
|
+ P3D_instance_finish_ptr = (P3D_instance_finish_func *)get_func(module, "P3D_instance_finish");
|
|
|
|
|
+ P3D_instance_setup_window_ptr = (P3D_instance_setup_window_func *)get_func(module, "P3D_instance_setup_window");
|
|
|
|
|
+
|
|
|
|
|
+ P3D_object_get_type_ptr = (P3D_object_get_type_func *)get_func(module, "P3D_object_get_type");
|
|
|
|
|
+ P3D_object_get_bool_ptr = (P3D_object_get_bool_func *)get_func(module, "P3D_object_get_bool");
|
|
|
|
|
+ P3D_object_get_int_ptr = (P3D_object_get_int_func *)get_func(module, "P3D_object_get_int");
|
|
|
|
|
+ P3D_object_get_float_ptr = (P3D_object_get_float_func *)get_func(module, "P3D_object_get_float");
|
|
|
|
|
+ P3D_object_get_string_ptr = (P3D_object_get_string_func *)get_func(module, "P3D_object_get_string");
|
|
|
|
|
+ P3D_object_get_repr_ptr = (P3D_object_get_repr_func *)get_func(module, "P3D_object_get_repr");
|
|
|
|
|
+ P3D_object_get_property_ptr = (P3D_object_get_property_func *)get_func(module, "P3D_object_get_property");
|
|
|
|
|
+ P3D_object_set_property_ptr = (P3D_object_set_property_func *)get_func(module, "P3D_object_set_property");
|
|
|
|
|
+ P3D_object_has_method_ptr = (P3D_object_has_method_func *)get_func(module, "P3D_object_has_method");
|
|
|
|
|
+ P3D_object_call_ptr = (P3D_object_call_func *)get_func(module, "P3D_object_call");
|
|
|
|
|
+ P3D_object_eval_ptr = (P3D_object_eval_func *)get_func(module, "P3D_object_eval");
|
|
|
|
|
+ P3D_object_incref_ptr = (P3D_object_incref_func *)get_func(module, "P3D_object_incref");
|
|
|
|
|
+ P3D_object_decref_ptr = (P3D_object_decref_func *)get_func(module, "P3D_object_decref");
|
|
|
|
|
+ P3D_make_class_definition_ptr = (P3D_make_class_definition_func *)get_func(module, "P3D_make_class_definition");
|
|
|
|
|
+ P3D_new_undefined_object_ptr = (P3D_new_undefined_object_func *)get_func(module, "P3D_new_undefined_object");
|
|
|
|
|
+ P3D_new_none_object_ptr = (P3D_new_none_object_func *)get_func(module, "P3D_new_none_object");
|
|
|
|
|
+ P3D_new_bool_object_ptr = (P3D_new_bool_object_func *)get_func(module, "P3D_new_bool_object");
|
|
|
|
|
+ P3D_new_int_object_ptr = (P3D_new_int_object_func *)get_func(module, "P3D_new_int_object");
|
|
|
|
|
+ P3D_new_float_object_ptr = (P3D_new_float_object_func *)get_func(module, "P3D_new_float_object");
|
|
|
|
|
+ P3D_new_string_object_ptr = (P3D_new_string_object_func *)get_func(module, "P3D_new_string_object");
|
|
|
|
|
+ P3D_instance_get_panda_script_object_ptr = (P3D_instance_get_panda_script_object_func *)get_func(module, "P3D_instance_get_panda_script_object");
|
|
|
|
|
+ P3D_instance_set_browser_script_object_ptr = (P3D_instance_set_browser_script_object_func *)get_func(module, "P3D_instance_set_browser_script_object");
|
|
|
|
|
+
|
|
|
|
|
+ P3D_instance_get_request_ptr = (P3D_instance_get_request_func *)get_func(module, "P3D_instance_get_request");
|
|
|
|
|
+ P3D_check_request_ptr = (P3D_check_request_func *)get_func(module, "P3D_check_request");
|
|
|
|
|
+ P3D_request_finish_ptr = (P3D_request_finish_func *)get_func(module, "P3D_request_finish");
|
|
|
|
|
+ P3D_instance_feed_url_stream_ptr = (P3D_instance_feed_url_stream_func *)get_func(module, "P3D_instance_feed_url_stream");
|
|
|
|
|
+ P3D_instance_handle_event_ptr = (P3D_instance_handle_event_func *)get_func(module, "P3D_instance_handle_event");
|
|
|
|
|
|
|
|
#undef get_func
|
|
#undef get_func
|
|
|
|
|
|
|
|
// Ensure that all of the function pointers have been found.
|
|
// Ensure that all of the function pointers have been found.
|
|
|
- if (P3D_initialize == NULL ||
|
|
|
|
|
- P3D_finalize == NULL ||
|
|
|
|
|
- P3D_set_plugin_version == NULL ||
|
|
|
|
|
- P3D_set_super_mirror == NULL ||
|
|
|
|
|
- P3D_new_instance == NULL ||
|
|
|
|
|
- P3D_instance_start == NULL ||
|
|
|
|
|
- P3D_instance_start_stream == NULL ||
|
|
|
|
|
- P3D_instance_finish == NULL ||
|
|
|
|
|
- P3D_instance_setup_window == NULL ||
|
|
|
|
|
-
|
|
|
|
|
- P3D_object_get_type == NULL ||
|
|
|
|
|
- P3D_object_get_bool == NULL ||
|
|
|
|
|
- P3D_object_get_int == NULL ||
|
|
|
|
|
- P3D_object_get_float == NULL ||
|
|
|
|
|
- P3D_object_get_string == NULL ||
|
|
|
|
|
- P3D_object_get_repr == NULL ||
|
|
|
|
|
- P3D_object_get_property == NULL ||
|
|
|
|
|
- P3D_object_set_property == NULL ||
|
|
|
|
|
- P3D_object_has_method == NULL ||
|
|
|
|
|
- P3D_object_call == NULL ||
|
|
|
|
|
- P3D_object_eval == NULL ||
|
|
|
|
|
- P3D_object_incref == NULL ||
|
|
|
|
|
- P3D_object_decref == NULL ||
|
|
|
|
|
-
|
|
|
|
|
- P3D_make_class_definition == NULL ||
|
|
|
|
|
- P3D_new_undefined_object == NULL ||
|
|
|
|
|
- P3D_new_none_object == NULL ||
|
|
|
|
|
- P3D_new_bool_object == NULL ||
|
|
|
|
|
- P3D_new_int_object == NULL ||
|
|
|
|
|
- P3D_new_float_object == NULL ||
|
|
|
|
|
- P3D_new_string_object == NULL ||
|
|
|
|
|
- P3D_instance_get_panda_script_object == NULL ||
|
|
|
|
|
- P3D_instance_set_browser_script_object == NULL ||
|
|
|
|
|
|
|
+ if (P3D_initialize_ptr == NULL ||
|
|
|
|
|
+ P3D_finalize_ptr == NULL ||
|
|
|
|
|
+ P3D_set_plugin_version_ptr == NULL ||
|
|
|
|
|
+ P3D_set_super_mirror_ptr == NULL ||
|
|
|
|
|
+ P3D_new_instance_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_start_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_start_stream_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_finish_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_setup_window_ptr == NULL ||
|
|
|
|
|
+
|
|
|
|
|
+ P3D_object_get_type_ptr == NULL ||
|
|
|
|
|
+ P3D_object_get_bool_ptr == NULL ||
|
|
|
|
|
+ P3D_object_get_int_ptr == NULL ||
|
|
|
|
|
+ P3D_object_get_float_ptr == NULL ||
|
|
|
|
|
+ P3D_object_get_string_ptr == NULL ||
|
|
|
|
|
+ P3D_object_get_repr_ptr == NULL ||
|
|
|
|
|
+ P3D_object_get_property_ptr == NULL ||
|
|
|
|
|
+ P3D_object_set_property_ptr == NULL ||
|
|
|
|
|
+ P3D_object_has_method_ptr == NULL ||
|
|
|
|
|
+ P3D_object_call_ptr == NULL ||
|
|
|
|
|
+ P3D_object_eval_ptr == NULL ||
|
|
|
|
|
+ P3D_object_incref_ptr == NULL ||
|
|
|
|
|
+ P3D_object_decref_ptr == NULL ||
|
|
|
|
|
+
|
|
|
|
|
+ P3D_make_class_definition_ptr == NULL ||
|
|
|
|
|
+ P3D_new_undefined_object_ptr == NULL ||
|
|
|
|
|
+ P3D_new_none_object_ptr == NULL ||
|
|
|
|
|
+ P3D_new_bool_object_ptr == NULL ||
|
|
|
|
|
+ P3D_new_int_object_ptr == NULL ||
|
|
|
|
|
+ P3D_new_float_object_ptr == NULL ||
|
|
|
|
|
+ P3D_new_string_object_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_get_panda_script_object_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_set_browser_script_object_ptr == NULL ||
|
|
|
|
|
|
|
|
- P3D_instance_get_request == NULL ||
|
|
|
|
|
- P3D_check_request == NULL ||
|
|
|
|
|
- P3D_request_finish == NULL ||
|
|
|
|
|
- P3D_instance_feed_url_stream == NULL ||
|
|
|
|
|
- P3D_instance_handle_event == NULL) {
|
|
|
|
|
|
|
+ P3D_instance_get_request_ptr == NULL ||
|
|
|
|
|
+ P3D_check_request_ptr == NULL ||
|
|
|
|
|
+ P3D_request_finish_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_feed_url_stream_ptr == NULL ||
|
|
|
|
|
+ P3D_instance_handle_event_ptr == NULL) {
|
|
|
|
|
|
|
|
logfile
|
|
logfile
|
|
|
<< "Some function pointers not found:"
|
|
<< "Some function pointers not found:"
|
|
|
- << "\nP3D_initialize = " << P3D_initialize
|
|
|
|
|
- << "\nP3D_finalize = " << P3D_finalize
|
|
|
|
|
- << "\nP3D_set_plugin_version = " << P3D_set_plugin_version
|
|
|
|
|
- << "\nP3D_set_super_mirror = " << P3D_set_super_mirror
|
|
|
|
|
- << "\nP3D_new_instance = " << P3D_new_instance
|
|
|
|
|
- << "\nP3D_instance_start = " << P3D_instance_start
|
|
|
|
|
- << "\nP3D_instance_start_stream = " << P3D_instance_start_stream
|
|
|
|
|
- << "\nP3D_instance_finish = " << P3D_instance_finish
|
|
|
|
|
- << "\nP3D_instance_setup_window = " << P3D_instance_setup_window
|
|
|
|
|
-
|
|
|
|
|
- << "\nP3D_object_get_type = " << P3D_object_get_type
|
|
|
|
|
- << "\nP3D_object_get_bool = " << P3D_object_get_bool
|
|
|
|
|
- << "\nP3D_object_get_int = " << P3D_object_get_int
|
|
|
|
|
- << "\nP3D_object_get_float = " << P3D_object_get_float
|
|
|
|
|
- << "\nP3D_object_get_string = " << P3D_object_get_string
|
|
|
|
|
- << "\nP3D_object_get_repr = " << P3D_object_get_repr
|
|
|
|
|
- << "\nP3D_object_get_property = " << P3D_object_get_property
|
|
|
|
|
- << "\nP3D_object_set_property = " << P3D_object_set_property
|
|
|
|
|
- << "\nP3D_object_has_method = " << P3D_object_has_method
|
|
|
|
|
- << "\nP3D_object_call = " << P3D_object_call
|
|
|
|
|
- << "\nP3D_object_eval = " << P3D_object_eval
|
|
|
|
|
- << "\nP3D_object_incref = " << P3D_object_incref
|
|
|
|
|
- << "\nP3D_object_decref = " << P3D_object_decref
|
|
|
|
|
-
|
|
|
|
|
- << "\nP3D_make_class_definition = " << P3D_make_class_definition
|
|
|
|
|
- << "\nP3D_new_undefined_object = " << P3D_new_undefined_object
|
|
|
|
|
- << "\nP3D_new_none_object = " << P3D_new_none_object
|
|
|
|
|
- << "\nP3D_new_bool_object = " << P3D_new_bool_object
|
|
|
|
|
- << "\nP3D_new_int_object = " << P3D_new_int_object
|
|
|
|
|
- << "\nP3D_new_float_object = " << P3D_new_float_object
|
|
|
|
|
- << "\nP3D_new_string_object = " << P3D_new_string_object
|
|
|
|
|
- << "\nP3D_instance_get_panda_script_object = " << P3D_instance_get_panda_script_object
|
|
|
|
|
- << "\nP3D_instance_set_browser_script_object = " << P3D_instance_set_browser_script_object
|
|
|
|
|
-
|
|
|
|
|
- << "\nP3D_instance_get_request = " << P3D_instance_get_request
|
|
|
|
|
- << "\nP3D_check_request = " << P3D_check_request
|
|
|
|
|
- << "\nP3D_request_finish = " << P3D_request_finish
|
|
|
|
|
- << "\nP3D_instance_feed_url_stream = " << P3D_instance_feed_url_stream
|
|
|
|
|
- << "\nP3D_instance_handle_event = " << P3D_instance_handle_event
|
|
|
|
|
|
|
+ << "\nP3D_initialize_ptr = " << P3D_initialize_ptr
|
|
|
|
|
+ << "\nP3D_finalize_ptr = " << P3D_finalize_ptr
|
|
|
|
|
+ << "\nP3D_set_plugin_version_ptr = " << P3D_set_plugin_version_ptr
|
|
|
|
|
+ << "\nP3D_set_super_mirror_ptr = " << P3D_set_super_mirror_ptr
|
|
|
|
|
+ << "\nP3D_new_instance_ptr = " << P3D_new_instance_ptr
|
|
|
|
|
+ << "\nP3D_instance_start_ptr = " << P3D_instance_start_ptr
|
|
|
|
|
+ << "\nP3D_instance_start_stream_ptr = " << P3D_instance_start_stream_ptr
|
|
|
|
|
+ << "\nP3D_instance_finish_ptr = " << P3D_instance_finish_ptr
|
|
|
|
|
+ << "\nP3D_instance_setup_window_ptr = " << P3D_instance_setup_window_ptr
|
|
|
|
|
+
|
|
|
|
|
+ << "\nP3D_object_get_type_ptr = " << P3D_object_get_type_ptr
|
|
|
|
|
+ << "\nP3D_object_get_bool_ptr = " << P3D_object_get_bool_ptr
|
|
|
|
|
+ << "\nP3D_object_get_int_ptr = " << P3D_object_get_int_ptr
|
|
|
|
|
+ << "\nP3D_object_get_float_ptr = " << P3D_object_get_float_ptr
|
|
|
|
|
+ << "\nP3D_object_get_string_ptr = " << P3D_object_get_string_ptr
|
|
|
|
|
+ << "\nP3D_object_get_repr_ptr = " << P3D_object_get_repr_ptr
|
|
|
|
|
+ << "\nP3D_object_get_property_ptr = " << P3D_object_get_property_ptr
|
|
|
|
|
+ << "\nP3D_object_set_property_ptr = " << P3D_object_set_property_ptr
|
|
|
|
|
+ << "\nP3D_object_has_method_ptr = " << P3D_object_has_method_ptr
|
|
|
|
|
+ << "\nP3D_object_call_ptr = " << P3D_object_call_ptr
|
|
|
|
|
+ << "\nP3D_object_eval_ptr = " << P3D_object_eval_ptr
|
|
|
|
|
+ << "\nP3D_object_incref_ptr = " << P3D_object_incref_ptr
|
|
|
|
|
+ << "\nP3D_object_decref_ptr = " << P3D_object_decref_ptr
|
|
|
|
|
+
|
|
|
|
|
+ << "\nP3D_make_class_definition_ptr = " << P3D_make_class_definition_ptr
|
|
|
|
|
+ << "\nP3D_new_undefined_object_ptr = " << P3D_new_undefined_object_ptr
|
|
|
|
|
+ << "\nP3D_new_none_object_ptr = " << P3D_new_none_object_ptr
|
|
|
|
|
+ << "\nP3D_new_bool_object_ptr = " << P3D_new_bool_object_ptr
|
|
|
|
|
+ << "\nP3D_new_int_object_ptr = " << P3D_new_int_object_ptr
|
|
|
|
|
+ << "\nP3D_new_float_object_ptr = " << P3D_new_float_object_ptr
|
|
|
|
|
+ << "\nP3D_new_string_object_ptr = " << P3D_new_string_object_ptr
|
|
|
|
|
+ << "\nP3D_instance_get_panda_script_object_ptr = " << P3D_instance_get_panda_script_object_ptr
|
|
|
|
|
+ << "\nP3D_instance_set_browser_script_object_ptr = " << P3D_instance_set_browser_script_object_ptr
|
|
|
|
|
+
|
|
|
|
|
+ << "\nP3D_instance_get_request_ptr = " << P3D_instance_get_request_ptr
|
|
|
|
|
+ << "\nP3D_check_request_ptr = " << P3D_check_request_ptr
|
|
|
|
|
+ << "\nP3D_request_finish_ptr = " << P3D_request_finish_ptr
|
|
|
|
|
+ << "\nP3D_instance_feed_url_stream_ptr = " << P3D_instance_feed_url_stream_ptr
|
|
|
|
|
+ << "\nP3D_instance_handle_event_ptr = " << P3D_instance_handle_event_ptr
|
|
|
<< "\n";
|
|
<< "\n";
|
|
|
unload_dso();
|
|
unload_dso();
|
|
|
return false;
|
|
return false;
|
|
@@ -319,10 +337,11 @@ load_plugin(const string &p3d_plugin_filename,
|
|
|
// Successfully loaded.
|
|
// Successfully loaded.
|
|
|
plugin_loaded = true;
|
|
plugin_loaded = true;
|
|
|
|
|
|
|
|
- if (!P3D_initialize(P3D_API_VERSION, contents_filename.c_str(),
|
|
|
|
|
- host_url.c_str(), verify_contents, platform.c_str(),
|
|
|
|
|
- log_directory.c_str(), log_basename.c_str(),
|
|
|
|
|
- trusted_environment, console_environment, NULL)) {
|
|
|
|
|
|
|
+ if (!P3D_initialize_ptr(P3D_API_VERSION, contents_filename.c_str(),
|
|
|
|
|
+ host_url.c_str(), verify_contents, platform.c_str(),
|
|
|
|
|
+ log_directory.c_str(), log_basename.c_str(),
|
|
|
|
|
+ trusted_environment, console_environment,
|
|
|
|
|
+ root_dir.c_str())) {
|
|
|
// Oops, failure to initialize.
|
|
// Oops, failure to initialize.
|
|
|
logfile
|
|
logfile
|
|
|
<< "Failed to initialize plugin (passed API version "
|
|
<< "Failed to initialize plugin (passed API version "
|
|
@@ -345,7 +364,7 @@ unload_plugin() {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- P3D_finalize();
|
|
|
|
|
|
|
+ P3D_finalize_ptr();
|
|
|
unload_dso();
|
|
unload_dso();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -361,55 +380,55 @@ unload_plugin() {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
static void
|
|
static void
|
|
|
unload_dso() {
|
|
unload_dso() {
|
|
|
|
|
+ if (dso_needs_unload) {
|
|
|
|
|
+ assert(module != NULL);
|
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
|
- assert(module != NULL);
|
|
|
|
|
- FreeLibrary(module);
|
|
|
|
|
- module = NULL;
|
|
|
|
|
|
|
+ FreeLibrary(module);
|
|
|
#else
|
|
#else
|
|
|
- assert(module != NULL);
|
|
|
|
|
- dlclose(module);
|
|
|
|
|
- module = NULL;
|
|
|
|
|
|
|
+ dlclose(module);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
+ module = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- P3D_initialize = NULL;
|
|
|
|
|
- P3D_finalize = NULL;
|
|
|
|
|
- P3D_set_plugin_version = NULL;
|
|
|
|
|
- P3D_set_super_mirror = NULL;
|
|
|
|
|
- P3D_new_instance = NULL;
|
|
|
|
|
- P3D_instance_start = NULL;
|
|
|
|
|
- P3D_instance_start_stream = NULL;
|
|
|
|
|
- P3D_instance_finish = NULL;
|
|
|
|
|
- P3D_instance_setup_window = NULL;
|
|
|
|
|
-
|
|
|
|
|
- P3D_object_get_type = NULL;
|
|
|
|
|
- P3D_object_get_bool = NULL;
|
|
|
|
|
- P3D_object_get_int = NULL;
|
|
|
|
|
- P3D_object_get_float = NULL;
|
|
|
|
|
- P3D_object_get_string = NULL;
|
|
|
|
|
- P3D_object_get_repr = NULL;
|
|
|
|
|
- P3D_object_get_property = NULL;
|
|
|
|
|
- P3D_object_set_property = NULL;
|
|
|
|
|
- P3D_object_has_method = NULL;
|
|
|
|
|
- P3D_object_call = NULL;
|
|
|
|
|
- P3D_object_eval = NULL;
|
|
|
|
|
- P3D_object_incref = NULL;
|
|
|
|
|
- P3D_object_decref = NULL;
|
|
|
|
|
-
|
|
|
|
|
- P3D_make_class_definition = NULL;
|
|
|
|
|
- P3D_new_undefined_object = NULL;
|
|
|
|
|
- P3D_new_none_object = NULL;
|
|
|
|
|
- P3D_new_bool_object = NULL;
|
|
|
|
|
- P3D_new_int_object = NULL;
|
|
|
|
|
- P3D_new_float_object = NULL;
|
|
|
|
|
- P3D_new_string_object = NULL;
|
|
|
|
|
- P3D_instance_get_panda_script_object = NULL;
|
|
|
|
|
- P3D_instance_set_browser_script_object = NULL;
|
|
|
|
|
-
|
|
|
|
|
- P3D_instance_get_request = NULL;
|
|
|
|
|
- P3D_check_request = NULL;
|
|
|
|
|
- P3D_request_finish = NULL;
|
|
|
|
|
- P3D_instance_feed_url_stream = NULL;
|
|
|
|
|
- P3D_instance_handle_event = NULL;
|
|
|
|
|
|
|
+ P3D_initialize_ptr = NULL;
|
|
|
|
|
+ P3D_finalize_ptr = NULL;
|
|
|
|
|
+ P3D_set_plugin_version_ptr = NULL;
|
|
|
|
|
+ P3D_set_super_mirror_ptr = NULL;
|
|
|
|
|
+ P3D_new_instance_ptr = NULL;
|
|
|
|
|
+ P3D_instance_start_ptr = NULL;
|
|
|
|
|
+ P3D_instance_start_stream_ptr = NULL;
|
|
|
|
|
+ P3D_instance_finish_ptr = NULL;
|
|
|
|
|
+ P3D_instance_setup_window_ptr = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ P3D_object_get_type_ptr = NULL;
|
|
|
|
|
+ P3D_object_get_bool_ptr = NULL;
|
|
|
|
|
+ P3D_object_get_int_ptr = NULL;
|
|
|
|
|
+ P3D_object_get_float_ptr = NULL;
|
|
|
|
|
+ P3D_object_get_string_ptr = NULL;
|
|
|
|
|
+ P3D_object_get_repr_ptr = NULL;
|
|
|
|
|
+ P3D_object_get_property_ptr = NULL;
|
|
|
|
|
+ P3D_object_set_property_ptr = NULL;
|
|
|
|
|
+ P3D_object_has_method_ptr = NULL;
|
|
|
|
|
+ P3D_object_call_ptr = NULL;
|
|
|
|
|
+ P3D_object_eval_ptr = NULL;
|
|
|
|
|
+ P3D_object_incref_ptr = NULL;
|
|
|
|
|
+ P3D_object_decref_ptr = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ P3D_make_class_definition_ptr = NULL;
|
|
|
|
|
+ P3D_new_undefined_object_ptr = NULL;
|
|
|
|
|
+ P3D_new_none_object_ptr = NULL;
|
|
|
|
|
+ P3D_new_bool_object_ptr = NULL;
|
|
|
|
|
+ P3D_new_int_object_ptr = NULL;
|
|
|
|
|
+ P3D_new_float_object_ptr = NULL;
|
|
|
|
|
+ P3D_new_string_object_ptr = NULL;
|
|
|
|
|
+ P3D_instance_get_panda_script_object_ptr = NULL;
|
|
|
|
|
+ P3D_instance_set_browser_script_object_ptr = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ P3D_instance_get_request_ptr = NULL;
|
|
|
|
|
+ P3D_check_request_ptr = NULL;
|
|
|
|
|
+ P3D_request_finish_ptr = NULL;
|
|
|
|
|
+ P3D_instance_feed_url_stream_ptr = NULL;
|
|
|
|
|
+ P3D_instance_handle_event_ptr = NULL;
|
|
|
|
|
|
|
|
plugin_loaded = false;
|
|
plugin_loaded = false;
|
|
|
}
|
|
}
|