How to save a C ++ object inside Java code? Possible?

First, I have an outdated C ++ library, and I port my Android application with a new interface.

At run time, there may be several C ++ objects created and destroyed dynamically. I created a set of native JNI methods to call the library to get this. But where should I store these objects in C ++? I have to keep track of them and set them free if they are not needed.

Until now, I knew that Java cannot reference a C ++ object. Is it possible to create a Java wrapper class that includes a reference to a C ++ object?

Thank.

+5
source share
2 answers

, . ++ java int. SWIG .

+3

JavaCPP , Pointer .

-1

All Articles