Compiler notes for handling of pointers
Examples
The following examples are intended for use when you are compiling your PASE for i programs on an AIX system. If you are using a compiler installed in PASE for i to compile your programs, you do not need to specify compiler options for the locations of IBM i system-unique header files or IBM i system-unique exports because these files will be found in their default path locations of /usr/include/ and /usr/lib/ on an IBM i system.
Example 1
The following command on an AIX system creates an PASE for i program named testpgm that can use IBM i system-unique interfaces exported by libc.a:
xlc -o testpgm -qldbl128 -qlonglong -qalign=natural
-bI:/mydir/as400_libc.exp testpgm.c
This example assumes that the IBM i system-unique header files are copied to the AIX directory /usr/include and that the IBM i system-unique exports files are copied to the AIX directory /mydir.
Example 2
The following example assumes IBM i system-unique headers and export files are in /pase/lib:
xlc -o as400_test -qldbl128 -qlonglong -qalign=natural -H16
-l c128
-I /pase/lib
-bI:/pase/lib/as400_libc.exp as400_test.c
Example 3
The following example builds the same program as example 2 with the same options; however, the xlc_r command is used for a multithreaded program to ensure that the compiled application links with threadsafe runtime libraries:
xlc_r -o as400_test -qldbl128 -qlonglong -qalign=natural -H16
-l c128
-I /pase/lib
-bI:/pase/lib/as400_libc.exp as400_test.c
In the examples, if you are using PASE for i support for IBM Db2 for i call level interfaces (CLIs), you also need to specify -bI:/pase/include/libdb400.exp on your build command.
The -bI directive tells the compiler to pass the parameter to the ld command. The directive specifies an export file containing exported symbols from a library to be imported by the application. |