I am using JNA to use the C ++ library in my Java application. I use the interface in Java to use these features. The function uses three arguments in C ++: unsigned int, const char * and long *. JNA implements strings (according to their docs) in Java to pass to char *. Similarly, for long *, long [] is used. However, I am confused by the type that should pass for an unsigned int. The char * passed in is the name of the file, and no matter what type I use for the first argument, it does not seem to recognize the file. In addition, the last, long type actually returns a value after the function is executed. If I use a short or int type for the first argument, this number seems correct, however, if I use a long type for the first argument, this is not true. Can anyone help?
As an example, here is what the actual prototype in C ++ is accompanied by what I now have as a prototype interface in Java:
int JrConnect(unsigned int id, const char* config_file, long* handle);
public int JrConnect(int[] id, String[] config_file, long[] handle);
source
share