For question #1: You can use a jchar. Primitive chars in java are not signed, it's about the only primitive that isn't. Note that jchar is a UTF-16 char, so you will have to "map" the jchar to a regular char, as you would have to with any character conversion issue.
For simple conversions, this can typically be done by casting char c_char = (char)java_char; because the core ASCII shares the same numeric values between ASCII and UTF-16. However, this is prone to error should anyone actually attempt to pass a "special" character through the interface. A much better way would be to (in the java side, as it is easier) convert the characters to bytes using the appropriate character set for your platform (to ensure platform compatibility in the C layers).
Then you only need to pass a byte to the JNI call, and the bytes will correctly correspond to the characters that C likely will expect. For question #2: If your CheckEnrollmentExists(...) method is the JNI binding entry point, you cannot change data types safely. That means that all entry inputs must be JNI data type values.
While you might be able to select the C data type equivalents (and you might be able to get your compiler to do it anyway) such techniques should be frowned upon. This implicitly means that JNI entry points cannot accept struct data structure not defined in the JNI headers. In other words, you can't pass your own struct to the method.
If the method needs access to a C struct across calls, use another means. I've seen people store the pointer to the allocated data structure in a member integer or long (doing correct casting). You can then rewrite the native code side to retrieve the pointer from the "this" object being passed into the call, and the do a dereference to obtain the required data.
For Question #3: This is actually the same as question #2. In the "binding wrapper" you put, you would retrieve the pointer's stored value in the java object's int or long field, cast it to the appropriate struct pointer and then pass it to the internal method. As the passing of the pointer is a C to C call, no extra magic is required.
Sorry but your answer do not help me as it do not contains any useful link or example of how I can solve my problem. Can you give me more detail information or article or some links in order I can check them out and find answer on my question! Thanks a lot!
– ViTo Brothers Apoyan Jun 3 '11 at 8:12 2 @ViTo, What problem? You asked three specific questions. All parameters passed into JNI bound methods must be jni.
H declared data types. Within C, you need to cast as appropriate. If you allocate, you need to store the per-object pointers in the Java class so when that class drops back down into the JNI layer, you can access the pointers.
– Edwin Buck Jun 3 '11 at 14:36 Thank you! – ViTo Brothers Apoyan Jun 6 '11 at 5:49 1 @ViTo, you are welcome, and good luck! – Edwin Buck Jun 6 '11 at 13:24.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.