Table 1-7 shows commands for compiling and linking Client-Library applications with libraries to take advantage of thread-safe support.
Platform |
Command |
---|---|
Sun Solaris 2.3 and later |
/opt/SUNWspro/bin/cc -I$SYBASE/$SYBASE_OCS/$SYNASE_OCS/include -L$SYBASE/$SYBASE_OCS/$SYBASE_OCS/lib -g \ -D_REENTRANT APP_FILES OCS_LIBS -lcs_r -ltcl_r -lcomn_r \-lintl_r -Bdynamic -lnsl -ldl -lpthread -lthread -lm -o program |
IBM RS/6000 |
xlc_r4 -I$SYBASE/$SYBASE_OCS/$SYBASE/$SYBASE_OCS/ $SYBASE_OCS/include -L$SYBASE/$SYBASE_OCS/$SYBASE/$SYBASE_OCS $SYBASE/$SYBASE_OCS/$SYBASE_OCS/lib -g -D_THREAD_SAFE \APP_FILES OCS_LIBS -lcs_r -ltcl_r -lcomn_r -lintl_r \ -lxdsxom -lpthread -lm -o program |
HP 9000(8xx) |
cc -I$SYBASE/$SYBASE_OCS/$SYBASE/$SYBASE_OCS/$SYBASE_OCS/include -L$SYBASE/$SYBASE_OCS/$SYBASE_OCS/lib -g -D_THREAD_SAFE \-D_REENTRANT -Ae APP_FILES OCS_LIBS -lcs_r \-ltcl_r -lcomn_r -lintl_r -Wl, -a,default -lcl -lm -lBSD \ -lpthread -lc_r -ldld -Wl,-E,+s -o program |
HP Tru64 UNIX |
cc -I$SYBASE/$SYBASE_OCS/include -L$SYBASE/$SYBASE_OCS/lib -threads APP_FILES \OCS_LIBS -lcs_r -ltcl_r -lcomn_r -lintl_r -lm -o program |
Linux |
cc -I$SYBASE/$SYBASE_OCS/include-L$SYBASE/$SYBASE_OCS/vlib APP_FILES OCS_LIBS-lcs_r -lsybtcl_r -lcomn_r -lintl_r -rdynamic -ldl -lpthread -lnsl -lm -o program |
In the link-and-compile lines listed in Table 1-4 through Table 1-7:
APP_FILES represents the source (.c) or object (.o) files for your application.
OCS_LIBS 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-threaded applications:
-lsrv (for Server-Library routines)
-lblk (for Bulk-Library routines)
-lct (for Client-Library routines)
For threaded applications:
-lsrv_r (for Server-Library routines)
-lblk_r (for Bulk-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. By not specifying this option, Client-Library uses shared versions of the Sybase libraries are used. When using shared libraries, the SH_LIB_PATH environment variable must include $SYBASE/$SYBASE_OCS/lib at runtime, and the application user must have read and execute permission on the libraries in $SYBASE/$SYBASE_OCS/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.
For SGI users:
Use the -n32 option for 32-bit machines, and -n64 for 64-bit machines.
You must set the environment variable LD_LIBRARY_PATH
to $SYBASE/$SYBASE_OCS/lib to
run programs linked with shareable (dynamic) libraries. If you are
running in debug mode, set LD_LIBRARY_PATH
to $SYBASE/$SYBASE_OCS/devlib to
run the program.
For HP Tru64 UNIX users:
The library file extensions for HP Tru64 UNIX are .a for static libraries and .so for sharable libraries. Use the following general command form to compile and link a Client-Library application:
Optimized libraries – nonthreaded, non-reentrant:
cc -I$SYBASE/$SYBASE_OCS/include program.c \ $SYBASE/$SYBASE_OCS/lib/libct.a \ $SYBASE/$SYBASE_OCS/lib/libcs.a \ $SYBASE/$SYBASE_OCS/lib/libtcl.a \ $SYBASE/$SYBASE_OCS/lib/libcomn.a \ $SYBASE/$SYBASE_OCS/lib/libintl.a \ -lm -o program
Debug libraries – nonthreaded, non-reentrant:
cc -g -I$SYBASE/$SYBASE_OCS/include \ -L$SYBASE/$SYBASE_OCS/devlib program.c \ -lct -lcs -ltcl -oldstyle_liblookup \ -lcomn -lintl \ -lm -o program
Shareable libraries – nonthreaded, non-reentrant:
cc -I$SYBASE/$SYBASE_OCS/include -L$SYBASE/$SYBASE_OCS/lib program.c \ -lct -lcs -ltcl -oldstyle_liblookup \ -lcomn -lintl \ -lm -o program
Optimized libraries – threaded, reentrant:
cc -I$SYBASE/$SYBASE_OCS/include -threads program.c \ $SYBASE/$SYBASE_OCS/lib/libct_r.a \ $SYBASE/$SYBASE_OCS/lib/libcs_r.a \ $SYBASE/$SYBASE_OCS/lib/libtcl_r.a \ $SYBASE/$SYBASE_OCS/lib/libcomn_r.a \ $SYBASE/$SYBASE_OCS/lib/libintl_r.a \ -lm -o program
Debug libraries – threaded, reentrant:
cc -I$SYBASE/$SYBASE_OCS/include -g -threads program.c \ -L$SYBASE/$SYBASE_OCS/devlib \ -oldstyle_liblookup -lct_r -lcs_r \ -ltcl_r -lintl_r \ -lm -o program
Shareable libraries – threaded, reentrant:
cc -I$SYBASE/$SYBASE_OCS/include -threads program.c \ -oldstyle_liblookup \ -lct_r -lcs_r -ltcl_r \ -lcomn_r -lintl_r \ -lm -o program