C Client Examples For Message Queue C-API


This directory contains C client examples to help you get started
using the Message Queue C-API. 

The Message Queue C-API allows clients written in the C/C++ programming 
languages to use Message Queue directly. The Message Queue C-API client 
runtime library communicates directly with the Message Queue broker.

The Message Queue C-API client runtime library mqcrt and the API header 
files are located in the following directories:

Solaris: /opt/SUNWimq/lib 
         /opt/SUNWimq/lib/sparcv9 (64-bit Solaris SPARC)
         /opt/SUNWimq/lib/amd64   (64-bit Solaris x86)
         /opt/SUNWimq/include

Linux:   /opt/sun/mq/lib
         /opt/sun/mq/include

AIX:     IMQ_HOME/lib
         IMQ_HOME/include

Windows: IMQ_HOME\lib
         IMQ_HOME\include

         where IMQ_HOME is the root Message Queue installation directory.


To build the examples, use a supported compiler (see Message Queue C-API 
documentation).

For example, to build the example program Producer in the directory 
producer_consumer,

On Solaris:

CC  -compat=5 -mt -DSOLARIS -I/opt/SUNWimq/include -o Producer \
    -L/opt/SUNWimq/lib -lmqcrt Producer.c

for 64-bit on Solaris SPARC,

CC  -compat=5 -mt -xarch=v9 -DSOLARIS -I/opt/SUNWimq/include -o Producer \
    -L/opt/SUNWimq/lib/sparcv9 -lmqcrt Producer.c

for 64-bit on Solaris x86,

CC  -compat=5 -mt -xarch=amd64 -DSOLARIS -I/opt/SUNWimq/include -o Producer \
    -L/opt/SUNWimq/lib/amd64 -lmqcrt Producer.c

On Linux: 

g++ -DLINUX -D_REENTRANT -I/opt/sun/mq/include -o Producer \
    -L/opt/sun/mq/lib -lmqcrt Producer.c

On AIX:

xlC_r -qthreaded -DAIX -I$IMQ_HOME/include -o Producer \
    -blibsuff:so -L$IMQ_HOME/lib -lmqcrt Producer.c

On Windows:

with Microsoft Visual Studio 2008 C/C++ compiler

to compile,

cl /c /MD -DWIN32 -I%IMQ_HOME%\include Producer.c

to link,

link Producer.obj /NODEFAULTLIB kernel32.lib msvcrt.lib /LIBPATH:%IMQ_HOME%\lib mqcrt.lib

to run on Windows, include %IMQ_HOME%\lib;%IMQ_HOME%\..\nss\lib in library search path


The following is a list of directories which contain the C client examples:

. producer_consumer
. producer_async_consumer
. request_reply
. tuxedo

Please see individual source files description or the Developer's Guide for
C Clients on how to run the examples. 

You should start the Message Queue broker before running the examples.

For tuxedo examples, please see README in tuxedo directory.
