Re: JNI working with jvalue (union)
- From: Thomas Fritsch <i.dont.like.spam@xxxxxxxxxxx>
- Date: Mon, 19 Sep 2005 15:51:57 GMT
Thomas Gärtner schrieb:
we are using Java JNI to call C++ methods from a java application. Java is calling a get method to get data, the type of this data is variable (int, double, string)No, you have to use the exact prototypes as generated by the javah-tool from your class file (more precisely: from its methods declared as native). Using slightly different prototypes won't work.
Is the JNI jvalue (union) datatype the right usage for this? For example:
Declare several native methods (one for int, double, String) in your Java code. Implement the same number of C/C++ methods (with the javah-generated prototypes). However, you may decide that all these methods call the same C/C++ utility function, which will then do the actual work.
JNIEXPORT void JNICALL getFromCppToJava(JNIEnv *env, jvalue var) { // i keep it very simple var.jint = 5, }
How is this resolved in java? How is the access to this union?
--
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@').
- References:
- JNI working with jvalue (union)
- From: Thomas Gärtner
- JNI working with jvalue (union)
- Prev by Date: Re: serialize failing in weird ways
- Next by Date: Re: Flowcharting Code in Java
- Previous by thread: JNI working with jvalue (union)
- Next by thread: Re: JNI working with jvalue (union)
- Index(es):
Relevant Pages
|