Oracle External Procedures - Page 2

Article Index
Oracle External Procedures
Page 2
Page 3
Page 4
Page 5
Page 6
All Pages

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:

 

  1. $ cc -c ${APPLICATION_HOME}/extprocs/hostcmd/hostcmd.c
  2. $ 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:


  1. $ gcc -c hostcmd.c -o hostcmd.o
  2. $ ld -G hostcmd.o -o libhostcmd.so

 

    You can check the symbols used:

 

  1. $ nm -S libhostcmd.so

Using SUN's CC on Solaris SPARC

 

  1. $ cc -xarch=generic64 -G -o hostcmd.so -h libhostcmd.so -Kpic hostcmd.c

 

Using GCC and Solaris LD on Solaris SPARC

 

  1. $ gcc -m64 -c hostcmd.c -o hostcmd.o
  2. $ ld  -m64 -G hostcmd.o -o libhostcmd.so

 

 

Using aCC V1.21 on HP-UX PA-RISC 2.0

 

  1. $ 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:


  1. C:> cl -I. /LD /D "_WIN32" -Zi hostcmd.c /link msvcrt.lib /nod:libcmt /DLL /OUT:libhostcmd.dll