Preparing C programs in AIX
This topic contains information about linking libraries necessary to prepare C programs on AIX .
Precompiled C programs are supplied in the MQ_INSTALLATION_PATH/samp/bin directory. Use the ANSI compiler and run the following commands. For more information about programming 64-bit applications, see Coding standards on 64-bit platforms.
MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.
For 32-bit applications:$ xlc_r -o amqsput_32 amqsput0.c -I MQ_INSTALLATION_PATH/inc -LMQ_INSTALLATION_PATH/lib -lmqmwhere amqsput0 is a sample program. For 64-bit applications:
$ xlc_r -q64 -o amqsput_64 amqsput0.c -I MQ_INSTALLATION_PATH/inc -LMQ_INSTALLATION_PATH/lib64 -lmqmwhere amqsput0 is a sample program.
If you are using the VisualAge® C/C++ compiler for C++ programs, you must include the option -q namemangling=v5 to get all the IBM MQ symbols resolved when linking the libraries.
If you want to use the programs on a machine that has only the IBM MQ MQI client for AIX installed, recompile the programs to link them with the client library (-lmqic) instead.
Linking libraries
You need the following libraries:- Link your programs with the appropriate library provided by IBM MQ.
In a non-threaded environment, link to one of the following libraries:
Library file Program/exit type libmqm.a Server for C libmqic.a & libmqm.a Client for C In a threaded environment, link to one of the following libraries:
Library file Program/exit type libmqm_r.a Server for C libmqic_r.a & libmqm_r.a Client for C For example, to build a simple threaded IBM MQ application from a single compilation unit run the following commands.
For 32-bit applications:$ xlc_r -o amqsputc_32_r amqsput0.c -I MQ_INSTALLATION_PATH/inc -LMQ_INSTALLATION_PATH/lib -lmqm_r
where amqsput0 is a sample program. For 64-bit applications:$ xlc_r -q64 -o amqsputc_64_r amqsput0.c -I MQ_INSTALLATION_PATH/inc -LMQ_INSTALLATION_PATH/lib64 -lmqm_r
where amqsput0 is a sample program.If you want to use the programs on a machine that has only the IBM MQ MQI client for AIX installed, recompile the programs to link them with the client library (-lmqic) instead.
Note:- We cannot link to more than one library. That is, we cannot link to both a threaded and a non-threaded library at the same time.
- If you are writing an installable service (see the Administer for further information), you need to link to the libmqmzf.a library in a non-threaded application and to the libmqmzf_r.a library in a threaded application.
- If you are producing an application for external coordination by an XA-compliant transaction manager such as IBM TXSeries®, Encina, or BEA Tuxedo, you need to link to the libmqmxa.a (or libmqmxa64.a if your transaction manager treats the 'long' type as 64 bit) and libmqz.a libraries in a non-threaded application and to the libmqmxa_r.a (or libmqmxa64_r.a ) and libmqz_r.a libraries in a threaded application.
- You need to link trusted applications to the threaded IBM MQ libraries. However, only one thread in a trusted application on IBM MQ on UNIX and Linux systems can be connected at a time.
- You must link IBM MQ libraries before any other product libraries.