Background:I am new to the JNI world, and not an experienced C programmer. I want to write an JNI for connecting a Java toolkit and a library in C (not just for speed, but for good functionality as well)I've seen some code using C++ for doing such work. And since managing resources in C requires more explicit manual control, I'd like to give C++ a try. Question:Would the mixing of C++ with C here cause problems that I could not see?
Downside of writing JNI with C++ for a library in C?
c++;c;native
The C++ wrapper of JNI is easy to use, and its object orientation is well designed. I personally find it makes the relationship between the JNI objects somewhat more visible and understandable than in the C interface (see examples here) . As you pointed out, if you're doing heavy C++ work to call some Java functionality, you could elaborate a little more the design and use constructors/destructors to automate some tasks that you would have to manually code in C.  However if you're doing the things the other way round, calling native C/C++ functions from Java, C++ won't bring you a big benefit: this calling interface is really designed for calling C functions (or static C++ functions with exposed as C). So if you want to use C++ classes, you have to organise the link between the static world and the objects that you create on C++ side.     Both can of course perfectly interoperate.  