|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-D69DD425-5F93-4238-A7E9-915F24A9C9CA" xml:lang="en"><title>Open |
|
13 C MessageQueue Library Example</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The Message Queue Library example demonstrates how to use Open C APIs for |
|
15 developing applications that use Open C standard libraries on Symbian platform. |
|
16 This example uses the APIs of the message queue library to create/close message |
|
17 queues and send/receive messages and also get information on created message |
|
18 queues. </p> |
|
19 <section id="GUID-026FD8D6-6C4A-5958-B289-775D4AE1E756-GENID-1-10-1-12-1-1-5-1-3-1-11-1-13-1-2-2"><title>Download</title> <p>Click |
|
20 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-9db026cc-ac23-4593-8bbc-4b251c085d4f.zip" scope="external"> opencmessagequeuelibraryex.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-9db026cc-ac23-4593-8bbc-4b251c085d4f.html" scope="peer">browse</xref> to view the example code. </p> </section> |
|
21 <section id="GUID-7E7C4564-B10E-41F9-8A9D-D8A6C5E9C51C-GENID-1-10-1-12-1-1-5-1-3-1-11-1-13-1-2-3"><title>Design and |
|
22 Implementation</title> <p>The following sections provide information about |
|
23 the implementation of the example. </p><p><b>Description</b></p><p>OpenCMessageQueueClientEx |
|
24 is a C Application that uses the Message Queue library. This application |
|
25 uses main() as the entry point for the application. This is a simple console |
|
26 based application. The application uses Message Queue library (OpenCMessageQueueLibrary.dll) |
|
27 APIs. The Main thread of the application creates two message queues, and |
|
28 two threads. Thread one will send message to message queue 1 and waits for |
|
29 messages from message queue 2. Then thread one will send message to message |
|
30 queue 2 and waits for messages from message queue 1. If a user tries to create |
|
31 a message queue using OpenCMessageQueueLibrary.dll with the already |
|
32 existing name, it will just return the existing message queue Id. The application |
|
33 has its own icon and can be launched from the UI both in the emulator and |
|
34 in the device. </p><p><b>Capabilities</b> </p> The program capabilities are |
|
35 defined in: <filepath>MessageQueueLibrary.mmp</filepath> (DLL - library):<codeph> CAPABILITY |
|
36 ALL -TCB</codeph> <filepath>MessageQueueClient.mmp</filepath>(EXE - application): <codeph>CAPABILITY |
|
37 NONE</codeph>. <p><b>Module hierarchy</b> </p>This application has 2 modules |
|
38 as below: <p>Message Queue Library (DLL) that exports set of apis for the |
|
39 user.</p><p>OpenCMessageQueueLibraryEx\engine : The application (EXE) that |
|
40 demonstrates the usage of Open C APIs and also those APIs exported by Message |
|
41 Queue Library.</p><p> (OpenCMessageQueueLibraryEx\exe) : This example will |
|
42 create a DLL which exports set of generic APIs with which the user can do |
|
43 message queue related operations. To give a rough idea on how to use these |
|
44 apis, an EXE is provided that creates threads and does send/receive on message |
|
45 queues using those exported apis.</p><p><b>APIs used</b></p><p>msgget </p><p> msgctl |
|
46 </p><p>msgrcv </p><p>msgsnd </p><p>semget </p><p>semctl </p><p> semop </p> </section> |
|
47 <section id="GUID-67A72761-1D92-46D1-B1C9-7455978BDE4E-GENID-1-10-1-12-1-1-5-1-3-1-11-1-13-1-2-4"><title>Building and |
|
48 Using</title> To build the Message Queue Library example application, go to |
|
49 the <filepath>OpenCMessageQueueLibraryEx\group</filepath> directory and build |
|
50 the application. The Message Queue Library application consists of two modules, |
|
51 which should be built in the following order: engine - which builds the |
|
52 generic message queue library exe - which builds an EXE that demonstrates |
|
53 the usage of this library The definition for the whole application can be |
|
54 found in the<filepath>bld.inf</filepath>in the group subdirectory of the applications |
|
55 main directory. </section> |
|
56 </conbody></concept> |