Preparing C programs

You need to link your programs with the appropriate library provided by WebSphere MQ.

If you are not working in a DCE-threaded environment or using CICS, you must link to one of the following libraries:

Library file Program/exit type
libmqm.so server for C
libmqic.so client for C

If you are working in a DCE-threaded environment or using CICS, you must link to the C library, libmqm_r.so.

Notes:

  1. If you are writing an installable service (see WebSphere MQ System Administration Guide for further information), you need to link to the libmqmzf.so library. Installable services must not use DCE.

  2. If you are producing an XA switch load file for external coordination by an XA-compliant transaction manager such as IBM CICS, Transarc Encina, or Novell Tuxedo, link to the libmqmxa.so library in a non-DCE threaded environment and to the libmqmxa_r.so library in a DCE threaded environment.

C compiler flags

When you compile dynamic libraries, or shared objects, for use with MQSeries for SINIX and DC/OSx, you must use the cc command in the final step that creates the library or object, and not merely the ld command. This is because the cc command automatically links various initialization data that is needed for proper dynamic linking and loading.

The order of the libraries specified is important. The following is an example of how to build the sample program amqsput0 for SINIX:

  cc -o amqsput0 -lmqm -lmqmcs -lmqmzse -lnsl   \
  -lsocket -ldl -lmproc -lext amqsput0.c

For DC/OSx Version cd087, include -liconv -lresolv on the above command, as shown below:

  cc -o amqsput0 -lmqm -lmqmcs -lmqmzse -lnsl   \
  -lsocket -ldl -liconv -lresolv  -lmproc -lext amqsput0.c

In the same way, for versions preceding cd087 of DC/OSx, include -liconv.

Note:
If you are using an additional product such as ENCINA, you need to find the appropriate header files. You can do this in two ways:
  1. Use the -I option to scan the extra include directory, for example:
      cc -c -I/opt/encina/include amqsxaex.c
    
  2. Symbolically link the header files into /usr/include, for example:
      ln -s /opt/encina/include/* /usr/include
    


© IBM Corporation 1993, 2002. All Rights Reserved