Preparing C programs in Linux

Precompiled C programs are supplied in the MQ_INSTALLATION_PATH/samp/bin directory. To build a sample from source code, use the gcc compiler.

MQ_INSTALLATION_PATH represents the high-level directory in which IBM® MQ is installed.

Work in your normal environment. For further information about programming 64 bit applications, see Coding standards on 64-bit platforms.

Linking libraries

The following tables lists the libraries that are needed when preparing C programs on Linux®.

  • You need to 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.so Server for C
    libmqic.so & libmqm.so Client for C

    In a threaded environment, link to one of the following libraries:

    Library file Program/exit type
    libmqm_r.so Server for C
    libmqic_r.so & libmqm_r.so Client for C
    Note:
    1. You cannot link to more than one library. That is, you cannot link to both a threaded and a non-threaded library at the same time.
    2. If you are writing an installable service (see the Administering for further information), you need to link to the libmqmzf.so library.
    3. 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.so (or libmqmxa64.so if your transaction manager treats the 'long' type as 64 bit) and libmqz.so libraries in a non-threaded application and to the libmqmxa_r.so (or libmqmxa64_r.so ) and libmqz_r.so libraries in a threaded application.
    4. You must link IBM MQ libraries before any other product libraries.