JNI In/Out parameters with C dlls
843829May 13 2002 — edited May 13 2002I've just created a JAVA Native Interface to connect with a C dll that I've created to wrap an existing C dll so that it meets the JNI name mangling conventions.
The JNI calls my C code perfectly, passing in all the right values, all the necessary operations are performed correctly, (I'm using the GetStringUTFChars, NewStringUTF and ReleaseStringUTFCharsmethods to convert between UTF and ASCII)
My JNI call is of the form:
methodName(addrerssToSearchFor, addressfoundFound, postcodeFound, offsetFound, etc);
i.e. I pass in the first value and use the C dll to populate the other values. (I know that in an ideal world I'd return an object with all these values as fields, but under my design constraints however it must be done by populating the parameters).
The problem is, when the program returns to the JAVA code all the values are lost, (i.e. even though I'm, using reference types it seems to be passing by value).
Basically, my call works but I don't get the values back.
Any ideas? Can you actually have "out" parameters with JNI?