IBM Streams 4.3.0

Creating C++ native functions

The SPL native function model declares your C++ native functions to the SPL compiler and IDE so that they can be used in the SPL code.

All native function implementations must provide a C++ header file that declares the native function implementations. SPL compiler-generated code includes this header file. The native function model declares the name of this header file and specifies a search path for the include file. The native function model also declares the name and location of any additional libraries and header files that the native function implementations depend on. These declarations enable the C++ compiler to locate these components when you build the SPL project.

Tip: Streams Studio provides a cheat sheet to guide you through the task of creating native functions. You can use the cheat sheet as an alternative to following the steps outlined in the following sections. To open the cheat sheets in Streams Studio:
  1. From the main menu, click Help > Cheat Sheets.
  2. In the Cheat Sheet Selection window, expand IBM Streams.
  3. Select a cheat sheet and click OK. The cheat sheet opens in the Cheat Sheets view.

Implementing native functions

There is much flexibility in how you can implement a native function. The following implementation decisions are important when you create native functions:
  • How you want to develop your native function implementation header file
  • Does your implementation use any external libraries
  • Does your implementation include any additional C++ code and header files

If you want to use the Eclipse C++ development tools (CDT) to develop your native functions header file, for any other C++ files that are included in your implementation you must create and configure a C++ implementation project that is linked to your SPL project. It is essentially the same as setting up a C++ project when you develop C++ Primitive Operators that include additional C++ code.

If you can implement your native functions in a single C++ header file and do not want to use the Eclipse C++ development tools (CDT), you do not need to create and configure a linked C++ implementation project.