The existing codes that I'm trying to port in is implemented in C++. After I write my java wrapper and run javah on the class to get a .h header file, .... is there a "correct" way to do things? Should my corresponding wrapper for my existing code be written in C or C++?
Thanks!
If you use plain JNI, you can write in both C and C++. The important thing is that if you are using C++, the JNI functions (like void Java_com_yourpackage_YourClass_yourMethod(JNIEnv* env, ...)
) must be declared as extern "C"
, but AFAIK javah
is doing it automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.