A simple C plug-in
The C version of the above example, simple_plugin.c, is very similar. The first difference is the use of the C version of the API, which is correlator_plugin.h. This can be located in the include directory of the Apama installation.
As before, there is only one function, called test, which takes a string as its sole parameter, makes some alterations to it, prints it out, and passes back another string as the result.
The C method that implements this plug-in function must be defined as follows:
static void AP_PLUGIN_CALL simplePluginTest(
const AP_PluginContext* ctx,
const AP_PluginTypeList* args,
AP_PluginType* rval,
AP_TypeDiscriminator rtype)
The rest of the example is very similar to the C++ example. The complete code base can be found in the file simple_plugin.c which is located in the samples\correlator_plugin\c directory of your Apama installation. A makefile (for use with GNU Make) and a batch file (for Microsoft’s Visual Studio) are provided in this directory to assist with compiling plug-ins on UNIX and Windows platforms respectively. A README.txt file in the directory describes how to build the plug-in.