...
Note: Additional samples will come in 2021.
C++ Modules - DrawCirclesCommand
...
Java: Create a nativ method
C++: Create a matching implementation
Store the C++ implementation inside a shared library
Create C++ module
Load C++ module
Compile the shared library and module with CMake
Load the shared library with System.LoadLibrary()
Call native method to load C++ module inside Java host application
1. C++ Modules - Java: Create a nativ method
...
Code Block |
---|
public static native void LoadJNI(); |
2. C++ Modules - C++: Create a matching implementation
...
Code Block |
---|
JNIEXPORT void JNICALL Java_com_graebert_aressimplified_JNI_LoadJNI( JNIEnv * env, jclass clazz ){...} |
3. C++ Modules - Store the C++ implementation inside a shared library
...
A CFxCommand must be registered before being used. It is recommended to register any command inside InitApp() and to remove any command inside UninitApp(). The command can be registered with odedRegCmds()->addCommand() and removed with odedRegCmds()->removeCnd().
5. C++ Modules - Load C++ module
...
Code Block |
---|
JNIEXPORT void JNICALL Java_com_graebert_aressimplified_JNI_LoadJNI( JNIEnv * env, jclass clazz ) { odrxDynamicLinker()->loadApp( L"DrawCircleCommandModule" ); } |
6. C++ Modules - Compile the shared library and module with CMake
See topic “Compile the shared library with CMake” for more information.
Java and C++ synergy
7. C++ Modules - Load the shared library with System.LoadLibrary()
See topic “Load the shared library with System.LoadLibrary()” for more information.
Java and C++ synergy
8. C++ Modules - Call native method to load C++ module inside Java host application
It is necessary to load all C++ modules before any features become active.
...