C++ API

This section provides APIs and examples for the C++ API for UDLs.

For information on setting up a C++ development environment and compiling and packaging libraries, see Developing with the C++ SDK.

Requirements for C++ UDLs

C++ UDLs:

  • Can run in Fenced and Unfenced Modes. Vertica enables fenced mode by default when you create a source, filter, or parser function, in Vertica unless you explicitly state otherwise.
  • Must not permit an exception to be passed back to Vertica. Doing so could lead to issues such as memory leaks caused by the memory allocated by the exception never being freed. Your UDL should always contain a top-level try-catch block to catch any stray exceptions caused by your code or libraries that your code calls.
  • Must properly free any resources that the UDL function allocates. Even a single byte of allocated memory that is not freed can become an issue in a UDL that is called over millions of rows. Instead of allocating memory directly, your function should use the memory allocation macros in the Vertica SDK. See Allocating Resources for UDxs for details.

The header files that define the majority of classes and methods are VerticaUDx.h and VerticaUDl.h. These header files, along with the main Vertica.h header file, are available in /opt/vertica/sdk/include.

In This Section