Posted By:
Alexander_Krapf
Posted On:
Wednesday, March 21, 2001 02:31 PM
Hi Vani,
it depends mostly on what the char** stands for. If it represents an array of character strings, your Java method should look like this:
( String[] arg1, IntHolder arg2, int arg3 )
In your native method you would have to extract the string bytes anf build a C-array of strings. The IntHolder assumes that you use this argument as an inout argument and that you have to read a result. IntHolder basically just wraps around a primitive int field. Enums map to ints or to enumeration classes. There are some articles available on how to represent enumeration types in Java, but that's is a whole different issue.
You might want to check out our JunC++ion product at http://www.codemesh.com. It would simplify the native method implementation drastically by allowing you to write code like this:
( ..., const String::array1D & arg1, IntHolder & arg2, jint arg3 )
{
char ** arr = new char* [ arg1.length ];
int inout = arg2.value;
myenum en = (myenum)arg3;
...
call_cpp( arr, &inout, en );
}
Much nicer than having to write all that JNI code...
Good luck,
Alex