IBM PureData System for Analytics, Version 7.1

Compiling and linking the shared library

After you create your C++ file for your new user-defined shared library, compile the C++ file by using the nzudxcompile command.

About this task

The command is in the /nz/kit/bin/adm directory. The compilation process creates the object files that run on the IBM® Netezza® host and on the Netezza SPUs.

You compile and link shared library C++ files to make it usable for the UDXs that reference them. You use the nzudxcompile command to compile and link a shared library for the host environment and on the SPUs.

Note: Unlike other UDXs, you cannot compile and register a shared library in one step with the nzudxcompile command. You must register the library by using CREATE LIBRARY.

To compile and link a shared library named mylib:

Procedure

  1. Create a compiled object for the Netezza host environment:
       nzudxcompile /home/nz/libs/mylib.cpp --host
    -o /home/nz/libs/mylib.o
  2. Link the compiled object into a shared library for the host:
       nzudxcompile --objs /home/nz/libs/mylib.o --host -o
    /home/nz/libs/host/mylib.so
  3. Create a compiled object for the Netezza SPU environment:
       nzudxcompile /home/nz/libs/mylib.cpp --spu -o
    /home/nz/libs/mylib.o 
  4. Link the compiled object into a shared library for the SPU:
       nzudxcompile --objs /home/nz/libs/mylib.o --dynamic --spu
    -o /home/nz/libs/spu/mylib.so
    Note: The --dynamic switch is used only when you are compiling shared libraries for the SPU environment.

Results

The nzudxcompile command creates the following object files:
mylib.o_x86
The object file for the Netezza host (i386 Linux platform on x86).
mylib.o_spu10
The object file for the Linux-based Rev10 SPus on IBM Netezza 1000 and Netezza 100 models.

What to do next

After you create the compiled object files, you must register the library with the Netezza system so that other UDXs can specify it as a dependency.



Feedback | Copyright IBM Corporation 2014 | Last updated: 2014-02-28