diff --git a/direct/src/plugin/load_plugin.cxx b/direct/src/plugin/load_plugin.cxx index cdeb5d2a7d..efeb683458 100755 --- a/direct/src/plugin/load_plugin.cxx +++ b/direct/src/plugin/load_plugin.cxx @@ -156,6 +156,7 @@ load_plugin(const string &p3d_plugin_filename, module = LoadLibrary(filename.c_str()); if (module == NULL) { // Couldn't load the DLL. + cerr << "Couldn't load " << filename << "\n"; return false; } @@ -164,9 +165,10 @@ load_plugin(const string &p3d_plugin_filename, #else // _WIN32 // Posix case. assert(module == NULL); - module = dlopen(filename.c_str(), RTLD_LOCAL); + module = dlopen(filename.c_str(), RTLD_LAZY | RTLD_LOCAL); if (module == NULL) { // Couldn't load the .so. + cerr << "Couldn't load " << filename << "\n"; return false; } diff --git a/direct/src/plugin/p3dPythonMain.cxx b/direct/src/plugin/p3dPythonMain.cxx index 88fc023c3b..0dbeb8eb9c 100644 --- a/direct/src/plugin/p3dPythonMain.cxx +++ b/direct/src/plugin/p3dPythonMain.cxx @@ -191,10 +191,16 @@ main(int argc, char *argv[]) { #else // _WIN32 // Posix case. - void *module = dlopen(dll_file, RTLD_LOCAL); + void *module = dlopen(dll_file, RTLD_LAZY | RTLD_LOCAL); if (module == NULL) { // Couldn't load the .so. cerr << "Couldn't load " << dll_file << "\n"; + char *message = dlerror(); + if (message != (char *)NULL) { + cerr << message << "\n"; + } else { + cerr << "No error.\n"; + } return 1; } diff --git a/direct/src/plugin/p3dSession.cxx b/direct/src/plugin/p3dSession.cxx index abcdc19ab8..02712eb393 100644 --- a/direct/src/plugin/p3dSession.cxx +++ b/direct/src/plugin/p3dSession.cxx @@ -1399,7 +1399,7 @@ p3dpython_thread_run() { #else // _WIN32 // Posix case. - void *module = dlopen(_p3dpython_dll.c_str(), RTLD_LOCAL); + void *module = dlopen(_p3dpython_dll.c_str(), RTLD_LAZY | RTLD_LOCAL); if (module == NULL) { // Couldn't load the .so. nout << "Couldn't load " << _p3dpython_dll << "\n";