...
In general returning back values to Java is quite easy but there is one important fact that must be considered. In the case the C++ method returns back an class object it must be returned strongly. This means it is not allowed to be destroyed inside the C++method else it will lead to a crash. Java is taking care about freeing the object after it is processed on Java side else it is always necessary to clean up object references to avoid running into limit of possible references. All FxJavaUtils class objects destroy the JNI reference automatically. Only in case the C++ method needs to return an Java class object it is highly important to use methods like GetStrongJObject() or GetStrongJString() else GetJObject() or GetJString() do the job. The usage of complex objects to carry more data can be read in the topic High level: C++ and JNI data transfer .
Status | ||||
---|---|---|---|---|
|
...