12-05-2020, 04:15 AM
(12-05-2020, 04:07 AM)megamarc Wrote: You picked two extreme cases
In order to communicate, sometimes the binding must do data conversion before passing the arguments. In other cases, it must create and destroy elements that are needed on the Java side.
The first example is the simplest one: no conversion of any data is needed, just call the function. Done!
The second one manages the callback, the Java function that needs to be called from the native library. Callbacks are always the trickiest part of a binding. In thsi case, it requires destroying a previously allocated Java object, and creating a new one. In addition, it gets a text string, that needs explicit conversion because C and Java don't represent strings internally in the same way. That's why this function is the most complex of all.
Oh I see, is there other functions in the new version that can ask for that kind of complex conversions?