classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GTK peers (-Dsomething.for.toolkit ?) (dynamic linking)


From: Tom Tromey
Subject: Re: GTK peers (-Dsomething.for.toolkit ?) (dynamic linking)
Date: 13 Aug 2001 18:06:48 -0600

>>>>> "John" == John Leuner <address@hidden> writes:

>> You should be able to finish up the peers by simply combining them
>> with a 1.1 JDK.

John> It's a pity you don't know what it is. I looked through the old
John> classpath mailing list archive but didn't find anything.

If I understand correctly, the property is `awt.toolkit'.
I believe this is documented in the Toolkit class (though I haven't
looked recently).

John> On another note, I would like to dynamically link the gtk code
John> into my JVM, but I can't do this because of the way the JNI
John> method names are formed.

John> My code just substitutes _ for . and hopes for the best, but
John> there seem to be more things to take into account. Any idea
John> where I can get code to do that? Does gcj have such code,
John> Japhar?

The easiest way to find the JNI name for a given method is to generate
the JNI header using gcjh.  Then read the header to see the name.

    gcjh -jni classname

gcjh can also generate JNI stubs for you.  It generates a skeleton C
file which you then fill in with implementations.  This will just
overwrite your existing `.c' file with the skeleton, so use with care:

    gcjh -jni -stubs classname

gcjh doesn't currently have a mode to just print out the names.
Nobody ever asked for that, and I never wanted it myself.

The libgcj JNI implementation also has some code that is used to
generate the JNI names (note there are two possible names for
non-overloaded methods; see the JNI spec).  This code is in
libjava/jni.cc.  I think it is relatively easy to understand.

You can also use any function name you want by registering the mapping
in JNI_OnLoad.  It is probably best to just stick with the normal
JNI-specific naming scheme though.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]