Compiling API exits

 


Once you have written an exit, you need to compile and link it as follows. The following examples show commands used for the sample program described in The API exit sample program. For platforms other than Windows systems, you can find the sample API exit code in install-dir/samp and the compiled and linked shared library in install-dir/samp/bin. For Windows systems, you can find the sample API exit code in install-dir\Tools\c\Samples. install-dir is the directory in which WebSphere MQ was installed.

 

On Solaris

  1. export LIB=/opt/mqm/lib:.:$LIB

  2. Ensure that the environment is set to use the correct versions of the compiler software and man pages:
    export PATH=/opt/SUNWspro/bin:$PATH 	
    export MANPATH=/opt/SUNWspro/man:/usr/man:$MANPATH 	
    export LD_LIBRARY_PATH = \ 	
    /opt/SUNWspro/lib:/$OPENWINHOME/lib:$LD_LIBRARY_PATH

  3. Compile the API exit source code:
    cc -KPIC -mt -o amqsaxe.o amqsaxe0.c  \
       -L/opt/mqm/lib -dy -G  \
       -lmqmzf  -lmqm  -lmqmcs  -lmqmzse

  4. Link the output from the compilation as a shared object:
    ld -L$LIB -dy -G -lmqmzf <amqsaxe>.o -o <amqsaxe>

 

On AIX

A file called amqsaxe.exp is supplied and contains the following:

 #!
 EntryPoint
 MQStart

  1. Compile the ApiExit source code:
     cc -c amqsaxe0.c

  2. Link the output from the compilation as non-threaded and threaded shared objects
     export myldflags=-bE:amqsaxe.exp -H512 -e MQStart -bM:SRE
     export mylibs=-lmqm -lmqmzf -lc
     export mylibs_r=-lmqm_r -lmqmzf_r -lpthreads_compat -lpthreads -lc_r
     ld amqsaxe0.o -o amqsaxe $myldflags $mylibs
     ld amqsaxe0.o -o amqsaxe_r $myldflags $mylibs_r 

 

On HP-UX

  1. Compile the ApiExit source code:
     export myinclude="-I/opt/mqm/inc -I. -I/usr/include -I/usr/include/sys"
     export myccflags="-D_HPUX_SOURCE +DAportable -c +e +z"
     c89 $myccflags $myinclude -o amqsaxe.o amqsaxe0.c

  2. Link the output from the compilation
     export mylibpath="-L. -L /opt/mqm/lib"
     export myldflags="-b -z +IMQStart +eMQStart +b :"
     ld -o amqsaxe $myldflags amqsaxe0.o $myldpath-lmqmzf
     ld -o amqsaxe_r $myldflags amqsaxe0.o $myldpath -lmqmzf_r
     ld -o amqsaxe_d $myldflags amqsaxe0.o $myldpath -lmqmzf_d

 

On Linux

Compile and link the ApiExit source code as non-threaded and threaded shared objects:

  gcc -o amqsaxe   -L/usr/lib -lmqm   -lmqmzf   -shared -I/usr/include amqsaxe0.c
  gcc -o amqsaxe_r -L/usr/lib -lmqm_r -lmqmzf_r -shared -I/use/include amqsaxe0.c

 

On Windows systems

  1. Create a file named amqsaxe.lnk containing the following:
     amqsaxe0.obj
     amqsaxe.exp
     mqm.lib mqmzf.lib
     msvcrt.lib oldnames.lib kernel32.lib user32
    amqsaxe.def is provided.

  2. Compile the ApiExit source code:
     set myccflags=-c -W3 -Gs- -Z7 -Od -nologo -LD -D_X86_=1
     set mydefines=-DWIN32 -D_WIN32 -D_MT -D_DLL
     cl %myccflags% %mydefines% amqsaxe0.c

  3. Link the output from the compilation
     link -nod -nologo -debug:full -dll @amqsaxe.lnk -out:amqsaxe.dll

 

On OS/400

An exit is created as follows (for a C language example):

  1. Create a module using CRTCMOD. Make sure that it is compiled to use teraspace, that is including the parameter TERASPACE(*YES *TSIFC).

  2. Create a service program from the module using CRTSRVPGM. You must bind it to the service program QMQM/LIBMQMZF_R for multithreaded API exits.

For information on configuring API exits, see the WebSphere MQ System Administration Guide.

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.