From ca7c2b85296ad76d29df2519a0977b26a5135aff Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 25 Oct 2002 03:28:00 +0000 Subject: natRuntime.cc (_Jv_SetDLLSearchPath): New function. * java/lang/natRuntime.cc (_Jv_SetDLLSearchPath): New function. (_Jv_FindSymbolInExecutable): Removed argument name. (insertSystemProperties): Call _Jv_SetDLLSearchPath if java.library.path is set. * gij.cc (help): Document --showversion. (version): Don't exit. (main): Handle --showversion. Exit if --version given. From-SVN: r58520 --- libjava/java/lang/natRuntime.cc | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'libjava/java/lang') 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 * -- cgit v1.1