How to compile Oracle Call Interface (OCI) program?

Links: http://www.dbatools.net/experience/compile_oci_program.html

    On Linux/Unix we can use gcc to compile OCI source code. Use the following command to compile the text unload utility as 64 bit binary.

gcc -m64 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/rdbms/demo -L${ORACLE_HOME}/lib -lclntsh -o ociuldr.bin ociuldr.c

    I usually compile it as 32 bit executable file by the following command.

gcc -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/rdbms/demo -L${ORACLE_HOME}/lib32 -lclntsh -o ociuldr.bin ociuldr.c

    On windows, I will use Microsoft Visual C++ as compiler. Run the following command to compile it.

set ORACLE_HOME=c:\oracle\product\10.2.0
set LIB=%LIB%;%ORACLE_HOME%\oci\include
set INCLUDE=%INCLUDE%;%ORACLE_HOME%\oci\lib\msvc
cl /ML /Feociuldr.exe ociuldr.c oci.lib

    For the Pro*C compilation, you just need to change the include file path and library path.

Post a comment

« Previous | Main | Next »

Powered by
Movable Type 3.36