Installing the External Table Protocol

    cc -fpic -c gpextprotocal.c cc -shared -o gpextprotocal.so gpextprotocal.o

    The option -fpic specifies creating position-independent code (PIC) and the -c option compiles the source code without linking and creates an object file. The object file needs to be created as position-independent code (PIC) so that it can be loaded at any arbitrary location in memory by Greenplum Database.

    The header files that are declared as include files in gpextprotocal.c are located in subdirectories of $GPHOME/include/postgresql/.

    For more information on compiling and linking dynamically-loaded functions and examples of compiling C source code to create a shared library on other operating systems, see the Postgres documentation at https://www.postgresql.org/docs/8.4/static/xfunc-c.html#DFUNC.

    The compiled code (shared object file) for the custom protocol must be placed in the same location on every host in your Greenplum Database array (master and all segments). This location must also be in the LD_LIBRARY_PATH so that the server can locate the files. It is recommended to locate shared libraries either relative to $libdir (which is located at $GPHOME/lib) or through the dynamic library path (set by the server configuration parameter) on all master segment instances in the Greenplum Database array. You can use the Greenplum Database utilities gpssh and gpscp to update segments.

    Parent topic: Example Custom Data Access Protocol