>>>>> Bernd Kreimeier writes:

    Bernd> Kenneth & Susan writes:
    >> I'm having trouble loading the java libraries and accessing the
    >> JNI Interfaces using dlopen/dlsym/dlclose.
    >> This works fine on Solaris, but for some reason it fails on Linux.
    >> First I use dlopen to load libjava.so, then
    >> I use dlsym to get the addresses for the JNI Interfaces
    >> (JNI_GetDefaultJavaVMInitArgs,  JNI_CreateJavaVM,
    >> JNI_GetCreatedJavaVMs) and call each as appropriate, but right after I
    >> load the library, I start getting

    Bernd> Just like I did. Happens with all JDK's including 1.1.6v5.
    Bernd> It even happens in the JDK 1.1.7v1a native thread port.
    Bernd> I've been told that there are wrappers now around the libdl
    Bernd> functions, but it doesn't seem to do the trick. 

The wrapper functions are used for green threads only. It seems that
they cause some trouble and so they will be removed in 1.1.8 (if
it should ever get released).

    Bernd> I got a small test program ("inload") source I am going to
    Bernd> submit to the group - Jitterbug if the Routers That Be
    Bernd> grace me with web access some time soon, e-mail else.

Bernd's inload program shows that we have indeed a problem with a 
dlopened libjava.so and native threads (don't try it with green 
threads, they are not designed for such things). Depending on the 
java/native stack size you'll get different error messages, but
basically it's infinite loop.

Now for the good news: The dlopen thing works on 1.2 without problems!


Bernd, a short note on DestroyJavaVM: 1.1 does not support unloading
the virtual machine (the JNI spec says it does not work in '1.1.2'
but it applies to all 1.1 JDKs, Sun only forgot to update the spec).
The 1.2 documentation for DestroyJavaVM is more precise: 1.2 still
does not support vm unloading and DestroyJavaVM *always* returns an 
error code.


        Juergen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802

Reply via email to