This section gives information on libraries, linking, and header files.
Client-Library and Server-Library now support dynamic
loading of Net-Library, directory, and security drivers. This change
affects the way you link Client-Library, Server-Library, and Embedded
SQL applications.
From this version onward, you no longer need to explicitly link the following object files with your applications:
Sybase Net-Library drivers (linker option -linsck for HP-UX, HP Tru64 UNIX, SGI, and IBM RS/6000, -ltli for Sun Solaris 2.x)
Sybase directory or security drivers (linker options -lddce and -lsdce)
The following tables list the general forms of the commands for compiling and linking Embedded SQL/C applications on Sybase supported platforms running the UNIX operating system.
Table 5-1 shows the commands for compiling and linking Embedded SQL/C applications using static libraries.
Platform |
Command |
---|---|
Sun Solaris 2.x |
/opt/SUNWspro/bin/cc -I$SYBASE/include -L$SYBASE/lib \ APP_FILES -lct -lcs -ltcl -lcomn -lintl -Bdynamic -lnsl -ldl -lm -o program |
IBM RS/6000 |
xlc_r4 -I$SYBASE/include -L$SYBASE/lib APP_FILES -lct \ -lcs -ltcl -lcomn -lintl -lm -o program |
HP 9000(8xx) |
cc -I$SYBASE/include -L$SYBASE/lib APP_FILES [-W1,-a,archive] \ -lct -lcs -ltcl -lcomn -lintl -Wl,-a,default -lcl -lm \ -lBSD -ldld -Wl, -E, +s -o program |
SGI |
cc -o [-n32 | -n64] -mips3 -I$SYBASE/include -Bstatic APP_FILES \ -L$SYBASE/lib -lct -lcs -ltcl -lcomn -lintl \ -Bdynamic -lm -o program |
HP Tru64 UNIX |
cc -I$SYBASE/include -L$SYBASE/lib APP_FILES -lct -lcs -ltcl \ -lcomn -lintl -lm -o program |
Linux |
cc -I$SYBASE/$SYBASE_OCS/include-L$SYBASE/$SYBASE_OCS/lib APP_FILES-lct -lcs -lsybtcl -lcomn -lintl -rdynamic -ldl -lnsl -lm -o program |
Table 5-2 shows the commands for compiling and linking Embedded SQL/C applications using debug libraries.
Platform |
Command |
---|---|
Sun Solaris 2.x |
/opt/SUNWspro/bin/cc -I$SYBASE/include -L$SYBASE/devlib \ -g APP_FILES -lct -lcs -ltcl -lcomn -lintl -Bdynamic -lnsl -ldl -lm -o program |
IBM RS/6000 |
xlc_r4 -I$SYBASE/include -L$SYBASE/devlib -g APP_FILES \ -lct -lcs -ltcl -lcomn -lintl -lm -o program |
HP 9000(8xx) |
cc -I$SYBASE/include -L$SYBASE/devlib -g APP_FILES \ [-Wl,-a,archive] -lct -lcs -ltcl -lcomn -lintl \ -Wl,-a,default -lcl -lm -lBSD -ldld -Wl, -E, +s -o program |
SGI |
cc -g [-n32 | -n64] -mips3 -I$SYBASE/include -L$SYBASE/devlib \ APP_FILES -lct -lcs -ltcl -lcomn -lintl -lm -o program |
HP Tru64 UNIX |
cc -I$SYBASE/include -L$SYBASE/devlib APP_FILES -lct -lcs \ -ltcl _oldstyle_liblookup -lcomn -lintl -lnsl -lm -o program |
Linux |
cc -I$SYBASE/$SYBASE_OCS/include-L$SYBASE/$SYBASE_OCS/devlib APP_FILES-lct -lcs -lsybtcl -lcomn -lintl -rdynamic -ldl -lnsl -lm -o program |
Table 5-3 shows the commands for compiling and linking Embedded SQL/C applications using shareable libraries (with dynamic drivers).
Platform |
Command |
---|---|
Sun Solaris 2.x |
cc -I$SYBASE/include -L$SYBASE/lib APP_FILES \ $SYBASE/include/sybesql.c -lct -lcs -ltcl \ -lcomn -lintl -ltli -lnsl -ldl -lm -o program |
HP 9000(8xx) |
cc -I$SYBASE/include -L$SYBASE/lib APP_FILES \ $SYBASE/include/sybesql.c -lct -lcs -ltcl \ -lcomn -lintl -linsck -Wl -lcl -lm -lBSD -o program |
SGI |
cc [-n32 | -n64] -mips3 -I$SYBASE/include -L$SYBASE/lib APP_FILES \ -lct -lcs -ltcl -lcomn -lintl -ldl -lm -o program |
HP Tru64 UNIX |
cc -I$SYBASE/include -L$SYBASE/lib APP_FILES \ -oldstyle_liblookup -lct -lcs -ltcl-lcomn \ -lintl -lm -o program |
Linux |
cc -I$SYBASE/$SYBASE_OCS/include-L$SYBASE/$SYBASE_OCS/devlib APP_FILES-lct -lcs -lsybtcl -lcomn -lintl -rdynamic -ldl -lnsl -lm -o program |
The object produced by compiling the sybesql.c file
contains utility routines that are used by Embedded SQL/C
applications. You must link sybesql.o in with
every application for the application to work properly.
The link line for an Embedded SQL/C application is identical to that used for a Client-Library application. In the link line, APP_FILES should include the following information, in the order given below:
Any generated C files (or .o files compiled from generated C files).
$SYBASE/include/sybesql.o (Make sure, if you upgrade, that you are using the latest version of this file.)
-lct represents the linker options to link in the Open Client and Open Server libraries that your code calls. These options can be specified by any or all of the following linker options, in the order shown:
For non-DCE applications |
For DCE applications |
---|---|
-lsrv (for Server-Library routines) |
-lsrv_r (for Server-Library routines) |
-lblk (for Bulk-Library routines) |
-lblk_r (for Bulk-Library routines) |
-lct (for Client-Library routines) |
-lct_r (for Client-Library routines) |
For HP-UX system users:
The option -W1,-a,archive causes the linker to statically link the Sybase libraries. Without it, shared versions of the Sybase libraries are used. In this case, the SH_LIB_PATH environment variable must include $SYBASE/lib at runtime, and the application user must have read and execute permission on the libraries in $SYBASE/lib.
HP-UX will not use the SH_LIB_PATH environment variable at runtime unless the application is linked with the +s linker option. You must use the +s linker options so that the system will be able to find Sybase libraries at runtime. -E is required to prevent undefined-symbol errors when driver libraries are loaded at runtime. See the HP-UX ld man page for more information.