Preparing C programs in HP Integrity NonStop Server

This topic contains information to consider when you are preparing C programs in HP Integrity NonStop Server together with examples of the commands you use when you are building applications when you are using the OSS C compiler and when you are using the Guardian C compiler.

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

You must link your programs with the appropriate library provided by IBM® MQ. The following table lists the libraries that you must link to when you are preparing C programs on HP Integrity NonStop Server.
Table 1. . HP Integrity NonStop Server link libraries
Library Description
libmqic.so OSS unthreaded
libmqic_r.so OSS multi-threaded
mqic Guardian

Multi-threaded native IBM MQ applications must use the Posix User Threads (PUT) feature. There is no support for Standard Posix Threads (SPT) in this product.

Building applications using the OSS C compiler

This section contains examples of the commands that are used to build programs that are targeted for either OSS or Guardian when you are using the OSS compiler.

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

The following example builds an unthreaded C client OSS application:

c89 -Wsystype=oss -o amqsputc amqsput0.c -IMQ_INSTALLATION_PATH/opt/mqm/inc
-LMQ_INSTALLATION_PATH/opt/mqm/lib -lmqic
The following example builds a multi-threaded C client OSS application:

c89 -Wsystype=oss -D_PUT_MODEL_ -o amqsputc amqsput0.c -IMQ_INSTALLATION_PATH/opt/mqm/inc
-LMQ_INSTALLATION_PATH/opt/mqm/lib -lmqic_r -lput
The following example builds a Guardian C client application:

c89 -Wsystype=guardian -o /G/vol/subvol/amqsputc amqsput0.c -IMQ_INSTALLATION_PATH/opt/mqm/inc
-LMQ_INSTALLATION_PATH/opt/mqm/lib/G -lmqic

Building applications using the Guardian C compiler

This section contains examples of the commands that are used to build programs that are targeted for Guardian when you are using the Guardian compiler.

MQ_INSTALLATION_PATH represents the Guardian volume and subvolume in which IBM MQ is installed.

The following example builds a Guardian C client application:
CCOMP /in AMQSPUT0/ AMQSPUTC;&
            runnable,systype guardian,nolist,&
            ssv0 "$system.system",&
            ssv1 "MQINSTALLATION_SUBVOL",&
            LD(-LMQINSTALLATION_SUBVOL -lmqic)
where LD is eld on NSI systems and xld on NSX systems.