Precompiled C programs are supplied in the /opt/mqm/samp/bin directory. To build a sample from source code, use a supported compiler (see Appendix A, Language compilers and assemblers for more information).
To compile, for example, the sample program amqsput0:
export PATH=/opt/SUNWspro/bin:$PATH export MANPATH=/opt/SUNWspro/man:/usr/man:$MANPATH export LD_LIBRARY_PATH= \ /opt/SUNWspro/lib:/$OPENWINHOME/lib:$LD_LIBRARY_PATH
cc -o <amqsput0> <amqsput0>.c -mt -lmqm -lmqmcs -lmqmzse \ -lsocket -lnsl -ldl
If you wish to compile a DCE application, use the following:
cc -o <amqsput0> <amqsput0>.c -mt -lmqm -lmqmcs_d -lmqmzse \ -ldce -lthread -lsocket -lnsl -ldl
If you use the unsupported compiler /usr/ucb/cc, your application may compile and link successfully. However when you run it, it will fail when it attempts to connect to the queue manager.
If you want to use the programs on a machine which has only the WebSphere MQ client for Solaris installed, recompile the programs to link them with the client library instead:
cc -o <amqsput0> <amqsput0>.c -lmqic -lmqmcs -lsocket
To build an WebSphere MQ client application that uses DCE, enter:
cc -o <amqsput0> <amqsput0>.c -mt -lmqic -lmqmcs_d -lmqmzse \ -ldce -lm -lpthread -lsocket -lc -lnsl -ldl
You must link with the WebSphere MQ libraries that are appropriate for your
application type:
Program/exit type |
Library files |
---|---|
Server for C |
libmqm.so, libmqmcs.so, and libmqmzse.so |
Client for C |
libmqic.so, libmqmcs.so, and libmqmzse.so |
Server for C with DCE |
libmqm.so, libmqmcs_d.so, and libmqmzse.so |
Client for C with DCE |
libmqic.so, libmqmcs_d.so, and libmqmzse.so |
Notes:
Also, link against libmqmcs_d.so instead of libmqmcs.so, in addition to the Encina and DCE libraries: