6.4. Use Callback to Make Interactive Calling Between C/C++ and Java

In previous sections, we concentrated on how to access the native methods from the Java domain. Basically, it is a function calling interface between the Java and the native domain. In this section, we want to create more interaction between Java and the native domain, which means that we need some feedback calling from the native domain. We still use C/C++ as our native language.

Interaction calling means that not only Java can make a native function call to the C/C++ domain but also C/C++ can make a call back to the Java domain. By using this interactive calling, C/C++ can even access the variables and methods defined in the Java domain, and modify the variables and methods ...

Get Applications Interface Programming Using Multiple Languages: A Windows® Programmer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.