dlload() a library from JDK's lib/ not knowing its full path (original) (raw)
Anthony Petrov anthony.petrov at oracle.com
Wed Nov 23 07:21:42 PST 2011
- Previous message: Shortcuts in Swing? (question for pals from Apple)
- Next message: SplashScreen and NSApplicationAWT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
I'm currently working on MACOSX_PORT-176 (AWT Splashscreen support), and I need to be able to dlopen() the splash screen dynamic library from the native code. The library normally goes into the lib/ subdirectory of the jdk (or jre).
I've grep'ed macosx native code for other dlopen() calls and found out that we either load '0' (i.e. the current process itself), or use full path names to load a couple of common libs (notably, JavaRuntimeSupport and libGL.dylib).
Apparently, in the former case we simply assume that all the necessary libs have already been loaded from Java code with a System.loadLibrary() call or an equivalent. In the case of the splash screen we can't load the library from Java because the JVM isn't started yet - the splash screen initialization code is triggered from the Java launcher code.
Using dlopen("libsplashscreen.dylib"...) fails since the lib/ directory isn't in the search path for the dlopen() function.
Any suggestions on how to load the library? Could I somehow retrieve the executable's path (which must be /bin/java or whatever other launcher is used) and calculate the full path for the library off it? Do I use argv[0] for that, or anything else specific to the Java launcher machinery (which I'm unfamiliar with, unfortunately)? Any other options?
-- best regards, Anthony
- Previous message: Shortcuts in Swing? (question for pals from Apple)
- Next message: SplashScreen and NSApplicationAWT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]