Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note: Additional samples will come in 2021.

C++ Modules - DrawCirclesCommand

...

  1. Java: Create a nativ method

  2. C++: Create a matching implementation

  3. Store the C++ implementation inside a shared library

  4. Create C++ module

  5. Load C++ module

  6. Compile the shared library and module with CMake

  7. Load the shared library with System.LoadLibrary()

  8. 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.

...