Compile and Link Source Code to Build Dynamically Linkable Libraries

Use compile and link switches when building dynamically linkable libraries for any user-defined function.

Warning!   Use fully-qualified path names for UDF libraries. In multiplex implementations, ensure the relative path is the same for all nodes.
  1. A UDF dynamically linkable library must include an implementation of the function extfn_use_new_api(). The source code for this function is in Setting the dynamic library interface. This function informs the server of the API style that all functions in the library adhere to. The sample source file my_main.cxx contains this function; you can use it without modification.

  2. A UDF dynamically linkable library must also contain object code for at least one UDF function. A UDF dynamically linkable library may optionally contain multiple UDFs.

  3. Link together the object code for each UDF as well as the extfn_use_new_api() to form a single library.

    For example, to build the library "libudfex:"
    • Compile each source file to produce an object file:

      my_main.cxx 
      my_bit_or.cxx 
      my_bit_xor.cxx 
      my_interpolate.cxx 
      my_plus.cxx 
      my_plus_counter.cxx 
      my_sum.cxx
      my_byte_length.cxx
      my_md5.cxx
      my_toupper.cxx
      tpf_agg.cxx
      tpf_blob.cxx
      tpf_dt.cxx
      tpf_filt.cxx
      tpf_oby.cxx
      tpf_pby.cxx
      tpf_rg_1.cxx
      tpf_rg_2.cxx
      udf_blob.cxx
      udf_main.cxx
      udf_rg_1.cxx
      udf_rg_2.cxx
      udf_rg_3.cxx
      udf_utils.cxx
    • Link together each object produced into a single library.

    After the dynamically linkable library has been compiled and linked:
    • Update the CREATE FUNCTION ... EXTERNAL NAME or CREATE PROCEDURE ... EXTERNAL NAME to include an explicit path name for the UDF library.
  4. Run iqdir16/samples/udf/build.bat on Windows. Run iqdir16/samples/udf/build.sh on UNIX.