JNI without Jni_Lookup() ?
Erik Poupaert
erik.poupaert@skynet.be
Mon Apr 19 23:14:00 GMT 2004
> You can't know until runtime which is the one to use (unless you design some way to
> tell gcj about it ahead of time).
To give an example for fixing code broken, because of overloaded native methods:
public JniClass
{
/* may lead to ambiguous javah-generated
jni signatures
when one of both is removed */
private native String f(int i);
private native String f(long l);
}
Can easily be fixed as following:
public JniClass
{
private String f(int i)
{
return fInt(i);
}
private String f(long)
{
return fLong(l);
}
/* home-cooked name mangling :-) */
private native String fInt(int i);
private native String fLong(long l);
}
More information about the Java
mailing list