I want to write a vector class (or something other) on C++. And I want to use its methods from Java. How to do this? I want to use JNI for this purpose. But javah generate me c prototypes. I want to store data in the C++ use area and use in java only an interface without fields. So, the problem is how to store the vector data in C-code.
Note:
Simply speaking, I need to wrap C++ interface by JNI and to have this interface in Java.
You will need to have a C-callable wrapper around your C++ code. The approach is similar to how you would allow a C++ library to be usable from pure C. Here is a simple example (with no error checking at all — do not use for real production code):