To compile your function, use gcc with the following flags and environment settings:
- Required: The SQLMR_SDK environment variable must be set to the path of your user defined function C API directory. This is the directory that includes example, include, and lib directories. For example, if you unpacked the API to ~/stage on your machine, then the setting is SQLMR_SDK=~/stage/sqlmr-sdk. We recommend that you make this setting part of your standard environment settings.
- Required: Use the -fpic flag to ensure your compiled function code is relocatable.
- Optional: For help in debugging, use the -Wall flag to show all compiler notifications.
- Optional: To create a debuggable executable, use the -g flag.
For example, to compile the tax_input.c example, you type:
gcc -fpic -c tax_input.c