+

Search Tips | Advanced Search

Writing channel-exit programs on UNIX, Linux, and Windows

We can use the following information to help you write channel-exit programs for UNIX, Linux , and Windows systems.

Follow the instructions outlined in Writing exits and installable services on UNIX, Linux and Windows. Use the following channel exit specific information, where appropriate:

The exit must be written in C, and is a DLL on Windows.

Define a dummy MQStart() routine in the exit and specify MQStart as the entry point in the library. Figure 1 shows how to set up an entry to your program:
Figure 1. Sample source code for a channel exit
#include <cmqec.h>

void MQStart() {;} /* dummy entry point - for consistency only */
void MQENTRY ChannelExit ( PMQCXP  pChannelExitParms,
                           PMQCD   pChannelDefinition,
                           PMQLONG pDataLength,
                           PMQLONG pAgentBufferLength,
                           PMQVOID pAgentBuffer,
                           PMQLONG pExitBufferLength,
                           PMQPTR  pExitBufferAddr)
{
... Insert code here
}

When writing channel exits for Windows using Visual C++, you must write your own DEF file. An example of how is shown in Figure 2. For further information on writing channel exit programs, see Writing channel-exit programs.

Figure 2. Sample DEF file for Windows
EXPORTS
ChannelExit