RTLD_LAZY

This commit is contained in:
David Rose 2009-08-31 16:36:50 +00:00
parent afc34e047d
commit 5fc0a429f6
3 changed files with 11 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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";