Apama 10.7.2 | Developing Apama Applications | Developing EPL Plug-ins | Writing EPL Plug-ins in C++ | Using plug-ins written in C++
 
Using plug-ins written in C++
The plug-in library you compiled must be available on the correlator's PATH (Windows) or LD_LIBRARY_PATH (Linux). By default, the $APAMA_WORK/lib directory is included on the appropriate path, and we recommend that you use this location for your own plug-ins.
Plug-ins are loaded using the import statement in EPL:
monitor m {
import "MyPlugin" as plugin;
}
This statement can be made at the top-level of either monitors or events.
The correlator then attempts to load MyPlugin.dll (Windows) or libMyPlugin.so (Linux) from the path. The correlator reads the list of exported methods from the plug-in. These methods are then available on the name provided in the as statement in the rest of that monitor or event:
event E {
import "MyPlugin" as plugin;
action increment(integer i) {
plugin.increment(i);
}
action get() returns integer {
return plugin.getCount();
}
}
Note:
When compiling with the GNU compiler collection (g++), it is not possible to completely unload plug-ins when GNU UNIQUE symbols are present. These are created transparently by the compiler. If you try and unload a plug-in via engine_delete and you see the warning telling you that the unloading of plug-in_name failed and that the DSO probably contains GNU UNIQUE symbols, then you are affected by this issue. If you need to do hot redeployment of your plug-in code (without restarting the correlator), then you will have to rename your plug-in and change the references to it in order to reload it into the same correlator.