Print this page

To create a MQ Message exit on Windows, do the following:

  1. Download Eclipse CDT.
  2. Download MINGW.  Add c:\mingw\bin to PATH.  Warning: IBM doesn't support MINGW.
  3. Restart Eclipse and select File->New Project ... ->C/C++ C project, press next.
  4. On the right hand side under Toolchains:, select "MinGW GCC" (if it doesn't show unselect "Show project types and toolchains only if they are supported on the platform").
  5. For Project Type:, select "Shared library", "Empty Project", ensure that the MinGW toolchain is still selected.  Enter a project name and press Next>.  Then, select Finish.
  6. Right click on the project and select "New->Source File".  An example amqsxrma.c is provided with MQ in tools,c,samples.
  7. Right click on the project and select "Properties".  Under 'C/C++ Build. Settings', "GCC C Compiler, Includes" add "C:\Program Files\IBM\WebSphere MQ\tools\c\include".  Under "MinGW C Linker, Libraries", add mqm under Libraries and add "C:\Program Files\IBM\WebSphere MQ\tools\Lib" under Library Search Path.

Add the following to the code:

#ifndef _int64
#define _int64 long long

To compile it, right click on the project and select "Build Project" or "Clean Project".  Alternatively, issue the following commands from DOS:

\MinGW\bin>gcc.exe  -IC:\MinGW\include -IC:\MinGW\lib\gcc\mingw32\4.5.2\include -I<mq path>:\Tools\c\include -O0 -g3 -Wall -c -fmessage-length=0 -oamqsxrma.o <path>\workspace\msgexit\amqsxrma.c

\MinGW\bin>gcc.exe -L"<mq path>:\Tools\Lib" -shared -o"amqsxrma.dll"  ./amqsxrma.o  -lmqm


Then, copy the dll file to the mq exits directory.

Alter the MQ channel as follows:

alter chl(chl1) chltype(rcvr) trptype(tcp) msgexit('amqsxrm(MsgExit)')

To compile the MQ message exit on other platforms, see "Writing and compiling channel exit programs" in the MQ Information Centre.