diff options
Diffstat (limited to 'libjava/java/lang/natRuntime.cc')
-rw-r--r-- | libjava/java/lang/natRuntime.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc index d0a64e7..0dcf578 100644 --- a/libjava/java/lang/natRuntime.cc +++ b/libjava/java/lang/natRuntime.cc @@ -102,14 +102,26 @@ _Jv_FindSymbolInExecutable (const char *symname) return NULL; } +void +_Jv_SetDLLSearchPath (const char *path) +{ + lt_dlsetsearchpath (path); +} + #else void * -_Jv_FindSymbolInExecutable (const char *symname) +_Jv_FindSymbolInExecutable (const char *) { return NULL; } +void +_Jv_SetDLLSearchPath (const char *) +{ + // Nothing. +} + #endif /* USE_LTDL */ @@ -538,6 +550,25 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops) // Allow platform specific settings and overrides. _Jv_platform_initProperties (newprops); + + // If java.library.path is set, tell libltdl so we search the new + // directories as well. FIXME: does this work properly on Windows? + String *path = newprops->getProperty(JvNewStringLatin1("java.library.path")); + if (path) + { + char *val = (char *) _Jv_Malloc (JvGetStringUTFLength (path) + 1); + jsize total = JvGetStringUTFRegion (path, 0, path->length(), val); + val[total] = '\0'; + _Jv_SetDLLSearchPath (val); + _Jv_Free (val); + } + else + { + // Set a value for user code to see. + // FIXME: JDK sets this to the actual path used, including + // LD_LIBRARY_PATH, etc. + SET ("java.library.path", ""); + } } java::lang::Process * |