Compiling channel exit programs on Windows, UNIX and Linux systems

Use the following examples to help you compile channel-exit programs for Windows, UNIX and Linux® systems.

[Windows]

Windows

The compiler and linker command for channel-exit programs on Windows:

cl.exe /Ic:\mqm\tools\c\include /nologo /c myexit.c
link.exe /nologo /dll myexit.obj /def:myexit.def /out:myexit.dll
[UNIX][Linux]

UNIX and Linux systems

In these examples exit is the library name and ChannelExit is the function name. On AIX® the export file is called exit.exp. These names are used by the channel definition to reference the exit program using the format described in MQCD- channel definition. See also the MSGEXIT parameter of the DEFINE CHANNEL command.

Sample compiler and linker commands for channel exits on AIX:

$ xlc_r -q64 -e MQStart -bE:exit.exp -bM:SRE -o /var/mqm/exits64/exit
exit.c -I/usr/mqm/inc
Sample compiler and linker commands for channel exits on HP-UX

$ c89 +DD64 +z -c -D_HPUX_SOURCE -o exit.o exit.c -I/opt/mqm/inc
$ ld -b exit.o +ee MQStart +ee ChannelExit -o
/var/mqm/exits64/exit -L/usr/lib/pa20_64 -lpthread
$ rm exit.o
Sample compiler and linker commands for channel-exits on Linux where the queue manager is 32 bit:

$ gcc -shared -fPIC -o /var/mqm/exits/exit exit.c -I/opt/mqm/inc
Sample compiler and linker commands for channel-exits on Linux where the queue manager is 64-bit:

$ gcc -m64 -shared -fPIC -o /var/mqm/exits64/exit exit.c -I/opt/mqm/inc
Sample compiler and linker commands for channel exits on Solaris:

$ cc -xarch=v9 -mt -G -o /var/mqm/exits64/exit exit.c -I/opt/mqm/inc
-R/usr/lib/64 -lsocket -lnsl -ldl

On the client, a 32 bit or 64 bit exit can be used. This exit must be linked to mqic_r.

On AIX, all functions that are called by IBM® MQ must be exported. A sample export file for this make file:

#
!channelExit
MQStart