Open C MessageQueue Library Example

The Message Queue Library example demonstrates how to use Open C APIs for developing applications that use Open C standard libraries on Symbian platform. This example uses the APIs of the message queue library to create/close message queues and send/receive messages and also get information on created message queues.

Download

Click on the following link to download the example: opencmessagequeuelibraryex.zip

Click: browse to view the example code.

Design and Implementation

The following sections provide information about the implementation of the example.

Description

OpenCMessageQueueClientEx is a C Application that uses the Message Queue library. This application uses main() as the entry point for the application. This is a simple console based application. The application uses Message Queue library (OpenCMessageQueueLibrary.dll) APIs. The Main thread of the application creates two message queues, and two threads. Thread one will send message to message queue 1 and waits for messages from message queue 2. Then thread one will send message to message queue 2 and waits for messages from message queue 1. If a user tries to create a message queue using OpenCMessageQueueLibrary.dll with the already existing name, it will just return the existing message queue Id. The application has its own icon and can be launched from the UI both in the emulator and in the device.

Capabilities

The program capabilities are defined in: MessageQueueLibrary.mmp (DLL - library): CAPABILITY ALL -TCB MessageQueueClient.mmp(EXE - application): CAPABILITY NONE.

Module hierarchy

This application has 2 modules as below:

Message Queue Library (DLL) that exports set of apis for the user.

OpenCMessageQueueLibraryEx\engine : The application (EXE) that demonstrates the usage of Open C APIs and also those APIs exported by Message Queue Library.

(OpenCMessageQueueLibraryEx\exe) : This example will create a DLL which exports set of generic APIs with which the user can do message queue related operations. To give a rough idea on how to use these apis, an EXE is provided that creates threads and does send/receive on message queues using those exported apis.

APIs used

msgget

msgctl

msgrcv

msgsnd

semget

semctl

semop

Building and Using

To build the Message Queue Library example application, go to the OpenCMessageQueueLibraryEx\group directory and build the application. The Message Queue Library application consists of two modules, which should be built in the following order: engine - which builds the generic message queue library exe - which builds an EXE that demonstrates the usage of this library The definition for the whole application can be found in thebld.infin the group subdirectory of the applications main directory.