JNI without Jni_Lookup() ?
Mon Apr 19 22:56:00 GMT 2004
> Yeah, but this won't work for JNI. One of the problems with JNI is
> that every method has two possible manglings. You can't know until
> runtime which is the one to use.
You're definitely right about the two accepted manglings.
I've just read confirmation for that in the relevant paragraph "Resolving
Native Method Names" at
Since javah defaults to short mangling, potential breakage would only occur in the
cases in which sources overload native methods (well knowing that C does not support
overloading ...), later on take away overloaded methods, so that the method is not
overloaded any longer, and finally still end up with a long name; while javah would
default to a short name in such case. Or maybe do it on purpose, because they prefer
the long names better :-)
I guess, however, that simply defaulting to what javah generates, as the single
acceptable mangling variant, would be a very acceptable solution.
As a further simplification, why not, just assume that there are no native
method overloading and therefore no resulting argument-type-based name mangling
suffixes? Heh. Simply ban it. I doubt it would break any code in circulation; at the
same time, having to fix broken code, in the very few cases that it would occur,
wouldn't be the big difficulty either.
More information about the Java