Kanzi Engine plugins¶
With Kanzi plugins you can extend the functionality of Kanzi and customize Kanzi to fit your application development requirements. When you create a Kanzi plugin you can share the extended functionality with any Kanzi user.
In Kanzi you can create and use these types of plugins:
Kanzi Engine plugins extend the functionality of Kanzi Engine. Kanzi Engine executes these plugins on target platforms.
You can create native plugins in C++, that work on all supported platforms. Or you can create Java plugins, that work only with Kanzi Android framework (droidfw), but allow greater integration with the Android operating system without needing to write any native glue code.
Kanzi Studio plugins extend the functionality of Kanzi Studio and run in Kanzi Studio.
See Kanzi Studio plugins.
Kanzi Engine plugins extend the functionality of Kanzi Engine. Kanzi Engine executes these plugins on target platforms.
Use a Kanzi Engine plugin to:
Create custom nodes using the Kanzi Engine API, use them in your Kanzi Studio projects, and see in the Kanzi Studio Preview how they work.
Create custom property types and messages using the Kanzi Engine API, and use them in your Kanzi Studio projects.
Define the data entry points to your Kanzi application, and form the contract between the Kanzi application designer and developer.
To learn how you can use Kanzi Engine plugins, see:
Deployment of native Kanzi plugins is flexible. You can use:
Dynamic linking. In this case the plugin is deployed as a dynamically linked library (.dll, .so, and so on). When using this approach:
You can add or remove plugins. For example, the Kanzi Studio Preview dynamically loads the plugins specified in the project.
You can independently update the plugins deployed as separate binaries. For example, do this to extend the functionality.
Application is allowed to depend on a particular plugin. You can reference the classes from a plugin indirectly through the content in a kzb file. Alternatively, application code can call class methods from a plugin directly.
Some platforms do not support or have limited support for dynamic libraries. For example, Android does not support independent updates of .apk content.
Static linking. In this case the plugin is deployed with the application binary. When using this approach:
You cannot remove or update the plugin without updating the application binary.
You can use some optimizations and can provide better performance.
You have to manually register all static plugins during the application startup in
Application::registerMetadataOverride()
.
The recommended approach is to build plugins as a .dll for use in the Kanzi Studio Preview and statically link the plugin to your application. This way you can use the plugin in the Preview and have the benefits of optimization in your application.
Each plugin provides a class derived from Module
. Before you can use a plugin you have to register its module. For platforms that support dynamic loading of libraries Kanzi Engine tries to do this automatically if the plugin is required but has not been loaded or registered yet. For platforms with no dynamic loading or for statically linked plugins you have to manually register the modules in Application::registerMetadataOverride()
.
Node2D_plugin
and Node3D_plugin
examples provide example code that registers the modules for the Android platform.