Building
Oracle's recommended way on UNIX
This will only build the required shared object binary as suggested by Oracle. It is very particular on the way in which the Oracle environment has been set up, so it this does not work, try one of the other methods below:
-
$ cc -c ${APPLICATION_HOME}/extprocs/hostcmd/hostcmd.c
-
$ make -f ${ORACLE_HOME}/rdbms/demo/demo_rdbms.mk extproc_callback SHARED_LIBNAME=${APPLICATION_HOME}/extProcs/hostcmd/hostcmd.so OBJS=hostcmd.o
Using GCC on any UNIX flavour
If on a non-GNU UNIX, ensure that the linker is not a GNU linker but the linker that came with the system. For a 32-bit system:
-
$ gcc -c hostcmd.c -o hostcmd.o
-
$ ld -G hostcmd.o -o libhostcmd.so
You can check the symbols used:
-
$ nm -S libhostcmd.so
Using SUN's CC on Solaris SPARC
-
$ cc -xarch=generic64 -G -o hostcmd.so -h libhostcmd.so -Kpic hostcmd.c
Using GCC and Solaris LD on Solaris SPARC
-
$ gcc -m64 -c hostcmd.c -o hostcmd.o
-
$ ld -m64 -G hostcmd.o -o libhostcmd.so
Using aCC V1.21 on HP-UX PA-RISC 2.0
-
$ aCC -O +DA2.0 +DS2.0 +z -b -c hostcmd.c -o libhostcmd.so
Do not use the stock cc C-compiler that comes with HP-UX. It is only good for rebuilding the kernel and is not ANSI-C complient. And even then it may not work. HP-UX seems a little brain-dead at the best if times. Still, for brain-deadness, nothing beats the following...
Windows
This will build the libhostcmd.dll dynamic link library in Windows:
-
C:> cl -I. /LD /D "_WIN32" -Zi hostcmd.c /link msvcrt.lib /nod:libcmt /DLL /OUT:libhostcmd.dll