My Android application has its own C ++ layer and Java level. The Java layer accesses the internal layer through JNI calls.
Can a C ++ layer safely create C ++ objects for its own internal use and store them in C ++ member variables? I am talking about C ++ objects that in some way do not require access to Java code, i.e. They are fully managed and deleted at the C ++ level. In other words, the same object (through a member variable) is accessed in all JNI calls, but only the C ++ level is required to access it.
I need confirmation in this question, because I know that there are special JNI methods for processing objects (corresponding terms: local link, global link, etc.). If I'm right, they only apply to objects that are visible (or created for) Java code.
Therefore, I believe that C ++ objects that are open only for creation can be created and deleted in the usual way (for example, new and delete ), and Java does not need to know anything about them. No special compatibility considerations are required if the objects and any references to them are exclusively at the C ++ level. It's right? Can I define C ++ classes and methods at this level just as if it were a regular C ++ application without any JNI / Java compatibility? To be general, is it allowed to instantiate and store simple C ++ objects, that is, objects that are not within the competence of Dalvik / JVM?
java android jni
Thomas Calc Jun 02 '14 at 13:43 on 2014-06-02 13:43
source share