Home

 

WebSphere MQ for Windows server, WebSphere MQ client for Windows

 

The exit is a DLL that must be written in C.

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 on Windows
#include <cmqc.h>
#include <cmqxc.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
}

In order to access the fields pointed to by pChannelExitParms and pChannelDefinition we need to insert the following lines in your exit program:

⋮
/* Variable definitions  */
⋮
   PMQCXP        pParms;
   PMQCD         pChDef;
⋮
/* Code                           */
⋮
  pParms   = (PMQCXP)pChannelExitParms;
  pChDef   = (PMQCD)pChannelDefinition;

The pointers pParms and pChDef can then be dereferenced to access individual fields.

When writing channel exits for these products using Visual C++, you should do the following:

  • Add MQMVX.LIB to project as a source file1.

  • Change the box labelled "Use Run-Time Library" from "Multithreaded" to "Multithreaded using DLL" in the project settings under C/C++ code generation.

  • Do not change the box labelled "Entry-Point Symbol". This box can be found in the project settings, under the Link tab, when you select Category and then Output.

  • Write your own .DEF file; an example of this is shown in Figure 2.

Figure 2. Sample DEF file for Windows
 LIBRARY exit
 
 PROTMODE
 
 DESCRIPTION 'Provides Retry and Channel exits'
 
 CODE SHARED    LOADONCALL
 DATA NONSHARED MULTIPLE
 
 HEAPSIZE   4096
 STACKSIZE  8192
 
 EXPORTS  Retry

 

Parent topic:

Writing and compiling channel-exit programs

1 MQMVX.LIB is used for data conversion and is not available


ic17670_


 

Home