Requirements for the C/C++ File

This section describes function and syntac requirements for the C/C++ file.

Your source code will need to #include the proper headers.

// Include the Sybase CEP header files.
#include "c8types.h"          // Definitions of C8Float, C8Bool, etc.
#include "c8adapter_in_process.h"
#include "c8conversions.h"    // Access to funcs like FloatToString() 
#include "c8server.h"

Your in-process adapter must contain initialize(), execute(), shutdown(), and, if your adapter supports Guaranteed Delivery, reconnect() functions. You can choose any names for these functions as long as those names don't duplicate the names of other functions, but you must tell the compiler and linker to make those names visible externally and to use the C naming conventions instead of the C++ naming conventions. To do this, your C file should have the following near the beginning:

// Ensure that functions are "exported" properly from dll.
#if defined(_MSC_VER)
#define USER_ADAPTER_EXPORT __declspec( dllexport )
#else // defined(_MSC_VER)
#define USER_ADAPTER_EXPORT 
#endif // defined(_MSC_VER)
// forward declarations of callback functions for 
// the in-process adapter
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
USER_ADAPTER_EXPORT 
C8Bool user_input_adapter_initialize(C8Adapter *adapter_ptr);
USER_ADAPTER_EXPORT 
C8Bool user_input_adapter_execute(C8Adapter *adapter_ptr);
USER_ADAPTER_EXPORT 
void   user_input_adapter_shutdown(C8Adapter *adapter_ptr);
// Reconnect callback required only if your adapter 
// supports Guaranteed Delivery
USER_ADAPTER_EXPORT 
C8Bool user_input_adapter_reconnect(C8Adapter *adapter_ptr);

In addition, your in-process adapter should contain the following at the end:

#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */

The combination of these two pieces of code tells the compiler that the functions you define between the "extern C {" and the closing "}" should be externally visible and should use the C naming convention, not the C++ name-mangling convention.

Use one of the examples that Sybase CEP ships as a starting point. Find the examples under the SybaseC8Repository at examples/FeatureExamples/Adapters/InProcess.