JNI hides library functions?
916747Feb 10 2012 — edited Feb 13 2012
I am working on a project which involves making a C API accessible to java programs. I have most of the capabilities working. Unfortunately, the two callback functions needed from the API are not fully working. I have the callback setup working properly (I am still working out some GlobalRef stuff and trying to understand AttachCurrentThread) in the situation that I do the callback from the main Java thread. I am having two main issues:
1) The callback is supposed to happen when a particular report comes in over USB from a microcontroller. Currently, the program is setup to call an intermediate C function which does some things then executes a CallVoidMethod(.....) into the java callback function. Currently, I don't think I even get into the intermediate C function, as I set a global in the function (and when I read it out in java, it never gets changed). I am more of a C guy, so the whole multi-thread world is pretty new to me. I feel like there was an important step here that I am missing.
2) When I make the C API dll with the wrapper functions, the only functions I can access after that are the java JNI functions. Why is that? How can I fix that? I am using cygwin/mingw32-make and a make file, but here is the gcc command executed:
gcc -mwin32 - shared -o API.dll *.o -lhid -lkernel32 -luser32 -lsetupapi -lwinmm -Wl,--kill-at
I have tried to read as much as I can about the Java Native functions and shared libraries, but nothing I have read so far indicates that Java would/should obscure the normal API functions.
Thanks for taking the time to read this and any help is greatly appreciated.