Linux Switches

Use the following compile and link switches when building shared libraries on Linux.

g++ 4.1.1 on x86

Important: Include the code for extfn_use_new_api() in each UDF library.

compile switches

-fPIC -fsigned-char -fno-exceptions -pthread -fno-omit-frame-pointer 
-Wno-deprecated -Wno-ctor-dtor-privacy -O2 -Wall
Note: When compiling C++ applications for building shared libraries on Linux, adding the -O2 and -Wall switches to the list of compile UDF switches decreases computation time.

link switches

-ldl -lnsl -lm -lpthread -shared -Wl,-Bsymbolic -Wl,-shared
Note: You can use gcc on Linux as well. While linking with gcc, link in the C++ run time library by adding -lstdc++ to the link switches.
Examples
  • Example 1
    g++ -c my_interpolate.cxx -fPIC -fsigned-char -fno-exceptions -pthread 
          -fno-omit-frame-pointer -Wno-deprecated -Wno-ctor-dtor-privacy 
          -I${IQDIR16}/sdk/include/
  • Example 2
    g++ -c my_main.cxx -fPIC -fsigned-char -fno-exceptions -pthread 
          -fno-omit-frame-pointer -Wno-deprecated -Wno-ctor-dtor-privacy 
          -I${IQDIR16}/sdk/include/
  • Example 3
    ld -G my_main.o my_interpolate.o -ldl -lnsl -lm -lpthread -shared 
          -o my_udf_library.so

xlC 10.0 on a PowerPC

compile switches

 -q64 -qarch=ppc64 -qcheck=nullptr -qinfo=gen -qtbtable=full -qsrcmsg 
-qnoansialias -qminimaltoc -qmaxmem=-1 -qenum=int -qhalt=e -qflag=w -qthreaded 
-qxflags=NLOOPING -qtmplinst=none

link switches

-qmkshrobj -ldl -lg  -qthreaded -lnsl -lm