Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
The Development Environment
Open System Services Porting Guide520573-006
2-16
C and C++ Compilation Using the c89 Utility
By default on a TNS/R platform, nld performs dynamic linking by searching first
for the file libc.srl and then libc.a. nld then performs static linking by
searching for the file libarchive.a. nld then performs dynamic linking by
searching first for the file libnative.srl and then libnative.a.
On a TNS/E platform, eld performs dynamic linking by searching first for the file
libc.so and then libc.a. eld then performs static linking by searching for the
file libarchive.a. eld then performs dynamic linking by searching first for the
file libnative.so and then libnative.a.
The following example compiles file.c and links the PIC linkfile into a PIC
program called a.out.
c89 file.c -lc -Wcall_shared -WBstatic -l archive -WBdynamic
-l native
ld (if the target platform is TNS/R) or eld (if the target platform is TNS/E)
performs dynamic linking by searching first for the file libc.so and then libc.a.
ld or eld then performs static linking by searching for the file libarchive.a. ld
or eld then performs dynamic linking by searching first for the file libnative.so
and then libnative.a.
The following command compiles the source file mydll.c and links the PIC linkfile
to create a DLL.
c89 -Wshared -o mydll mydll.c
ld or eld performs the linking and creates a DLL in a file named mydll.
The following example compiles file.c with SQL/MP support enabled with the
native C compiler.
c89 -Wsql=release2,sqlmap -c file.c
An SQL map is included in the listing, and the release 2 version of SQL/MP
features is used. The SQL/MP preprocessor is run; the SQL/MP compiler is not
run. Note that there is no blank space after the comma (,) and no space before or
after the equal sign. Because the -c flag is used, no binding is performed.
The following example compiles file.c with SQL/MX support enabled with the
native C compiler, and creates file.o if there are no errors in compilation:
c89 -Wsqlmx=listing -c file.c
The SQL/MX preprocessor is run; the SQL/MX compiler is not run. An SQL error
log named file.eL is created if necessary because listing is specified, and an
SQL module definition file named file.m is created. Note that there is no blank
space after the comma (,). Because the -c flag is used, no binding is performed.
The following example uses the TNS C compiler. The source file test.c is
compiled into test.o. The warnings of types 96, 93, and 168 are suppressed:
c89 -c -Wccom="nowarn(96,93,168)" test.c