Building libraries for use with TXSeries for Multiplatforms

Use this information when building libraries for use with TXSeries® for Multiplatforms.

Pre-built switch load files are shared libraries (called DLLs on the Windows system) that you can use with CICS® programs, which require a 2-phase commit transaction by using the XA protocol. The names of these pre-built libraries are in the table Essential code for CICS applications: XA initialization routine. Sample source code is also supplied in the following directories:
Table 1. Installation directories on Windows, UNIX and Linux operating systems
Platform Directory Source file
[UNIX][Linux]UNIX and Linux® MQ_INSTALLATION_PATH/samp/ amqzscix.c
[Windows]Windows MQ_INSTALLATION_PATH\Tools\c\Samples amqzscin.c
where MQ_INSTALLATION_PATH is the directory in which you installed IBM® MQ.
To build the switch load file from the sample source, follow the instructions appropriate for your operating system:
[AIX]AIX®
Issue the following command:
export MQM_HOME=/usr/mqm
echo "amqzscix" > tmp.exp
xlc_r $MQM_HOME/samp/amqzscix.c -I/usr/lpp/cics/include -I$MQM_HOME/inc -e amqzscix -bE:tmp.exp -bM:SRE
    -o amqzsc /usr/lpp/cics/lib/regxa_swxa.o -L$MQM_HOME/lib -L/usr/lpp/cics/lib -lcicsrt -lEncina 
    -lEncServer -lpthreads -lsarpc -lmqmcics_r -lmqmxa_r -lmqzi_r -lmqmcs_r
rm tmp.exp
[Solaris]Solaris
Issue the following command:

/opt/SUNWspro/bin/cc -s -l/opt/encina/include amqzscix.c -G -o amqzscix -e
    CICS_XA_Init -L MQ_INSTALLATION_PATH/lib -L/opt/encina/lib
    -L/opt/dcelocal/lib /opt/cics/lib/reqxa_swxa.o
    -lmqmcics -lmqmxa -lmqzi -lmqmcs -lmqmzse -lcicsrt -lEncina -lEncSfs -ldce
[Linux]Linux platforms
Issue the following command:

gcc -m32 -shared -fPIC -o amqzscix amqzscix.c
    \-IMQ_INSTALLATION_PATH/inc -I CICS_INSTALLATION_PATH/include
    \-LMQ_INSTALLATION_PATH/lib -Wl,-rpath=MQ_INSTALLATION_PATH/lib
    \-Wl,-rpath=/usr/lib -Wl,-rpath-link,/usr/lib -Wl,--no-undefined
    -Wl,--allow-shlib-undefined \-L CICS_LIB_PATH/regxa_swxa.o \-lpthread -ldl -lc
    -shared -lmqzi_r -lmqmxa_r -lmqmcics_r -ldl -lc
[Windows]Windows
Follow these steps:
  1. Use the cl command to build amqzscin.obj by compiling at least the following variables:
    cl.exe -c -I EncinaPath\include -I MQ_INSTALLATION_PATH\include -Gz -LD amqzscin.c
    
  2. Create a module definition file named mqmc1415.def, which contains the following lines:
    LIBRARY MQMC4SWI
    EXPORTS
    CICS_XA_Init
    
  3. Use the lib command to build an export file and an import library by using at least the following option:
    lib -def:mqmc4swi.def -out:mqmc4swi.lib
    
    If the lib command is successful then an mqmc4swi.exp file is also built.
  4. Use the link command to build mqmc4swi.dll by using at least the following option:
    link.exe -dll -nod -out:mqmc4swi.dll 
        amqzscin.obj CicsPath\lib\regxa_swxa.obj 
        mqmc4swi.exp mqmcics4.lib
        CicsPath\lib\libcicsrt.lib
        DcePath\lib\libdce.lib DcePath\lib\pthreads.lib
        EncinaPath\lib\libEncina.lib
        EncinaPath\lib\libEncServer.lib 
        msvcrt.lib kernel32.lib