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 IBM AIX, you need to use the following command to compile ociuldr to support 64 bit IO feature.
gcc -D_LARGE_FILES -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 INCLUDE=%LIB%;%ORACLE_HOME%\oci\include
set LIB=%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.

Comments (9)
On AIX, we need to add the following macro to support 64 bit IO function.
gcc -D_LARGE_FILES ......
Posted by anysql | March 18, 2009 11:50 AM
Can i compile it with HP-UX 11.11,11.23 cc command?
Posted by l1t | May 23, 2009 12:59 PM
/oracle>cc -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/rdbms/demo -L${ORACLE_HOME}/lib -o ociuldr.bin ociuldr.c
(Bundled) cc: "/oracle/product/10.2/rdbms/public/oratypes.h", line 30: warning 5: "signed" will become a keyword.
(Bundled) cc: "/oracle/product/10.2/rdbms/public/oratypes.h", line 30: error 1000: Unexpected symbol: "char".
(Bundled) cc: "/oracle/product/10.2/rdbms/public/oratypes.h", line 60: error 1000: Unexpected symbol: "b1".
Posted by l1t | May 23, 2009 1:27 PM
I haven't tested the compilation on HPUX, you can install gcc on it.
Posted by anysql | May 23, 2009 1:35 PM
hpux 11.11
complied use gcc 4.2.3 with 2nd command success
but it's slow
./ociuldr.bin test/test query="select * from j601" file='j601.csv' head=Yes
0 rows exported at 2009-05-23 16:25:19
500000 rows exported at 2009-05-23 16:26:24
only 500000 rows per second
Posted by l1t | May 23, 2009 5:12 PM
it's fast
compare to exp direct=y/n
1791529857 j601.csv 11m 1s
2367672320 j601.dmp 4m 14s y
2377957376 j601.dmp 11m 14s n
Posted by l1t | May 23, 2009 5:41 PM
I got the same result as you in other performance test.
Posted by anysql | May 23, 2009 6:51 PM
faster than hrb_qiuyb 's ociuldr_v2.1
real 15m12.85s
user 14m28.19s
sys 0m25.60s
Posted by l1t | May 25, 2009 9:46 AM
This is an awesome post, I will definitely be sure to add you to my list :)
Posted by Manuela Woolard | December 10, 2009 6:42 AM