Browse Source

RTLD_LAZY

David Rose 16 years ago
parent
commit
5fc0a429f6

+ 3 - 1
direct/src/plugin/load_plugin.cxx

@@ -156,6 +156,7 @@ load_plugin(const string &p3d_plugin_filename,
   module = LoadLibrary(filename.c_str());
   module = LoadLibrary(filename.c_str());
   if (module == NULL) {
   if (module == NULL) {
     // Couldn't load the DLL.
     // Couldn't load the DLL.
+    cerr << "Couldn't load " << filename << "\n";
     return false;
     return false;
   }
   }
 
 
@@ -164,9 +165,10 @@ 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_LOCAL);
+  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.
+    cerr << "Couldn't load " << filename << "\n";
     return false;
     return false;
   }
   }
 
 

+ 7 - 1
direct/src/plugin/p3dPythonMain.cxx

@@ -191,10 +191,16 @@ main(int argc, char *argv[]) {
     
     
 #else  // _WIN32
 #else  // _WIN32
   // Posix case.
   // Posix case.
-  void *module = dlopen(dll_file, RTLD_LOCAL);
+  void *module = dlopen(dll_file, RTLD_LAZY | RTLD_LOCAL);
   if (module == NULL) {
   if (module == NULL) {
     // Couldn't load the .so.
     // Couldn't load the .so.
     cerr << "Couldn't load " << dll_file << "\n";
     cerr << "Couldn't load " << dll_file << "\n";
+    char *message = dlerror();
+    if (message != (char *)NULL) {
+      cerr << message << "\n";
+    } else {
+      cerr << "No error.\n";
+    }
     return 1;
     return 1;
   }
   }
 
 

+ 1 - 1
direct/src/plugin/p3dSession.cxx

@@ -1399,7 +1399,7 @@ p3dpython_thread_run() {
 
 
 #else  // _WIN32
 #else  // _WIN32
   // Posix case.
   // 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) {
   if (module == NULL) {
     // Couldn't load the .so.
     // Couldn't load the .so.
     nout << "Couldn't load " << _p3dpython_dll << "\n";
     nout << "Couldn't load " << _p3dpython_dll << "\n";