|
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 task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-895A685E-83E8-51A3-A823-3A0E07B1E609" xml:lang="en"><title>Exporting |
|
13 the Implementation Factories </title><abstract><p>An implementation collection gathers one or more interface implementations |
|
14 in a DLL. It provides necessary information to the plug-in framework to use |
|
15 them. The collection must export a single function that provides an array. |
|
16 This array maps the UID of each implementation it contains with a pointer |
|
17 to its factory instantiation function (NewL() in our example). </p></abstract><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
18 <steps id="GUID-B972BA4F-6146-59A7-AA8E-8ACC704F34FB"> |
|
19 <step id="GUID-E2BCAA54-9873-5AB5-93F8-6F1CE28D184D"><cmd/> |
|
20 <info>Define a UID for each implementation. This UID maps to the instantiation |
|
21 function of the implementation. Construct an array of UID's for all the implementations |
|
22 in the collection. </info> |
|
23 <stepxmp><codeblock id="GUID-F1292D30-2559-5F6C-ACD5-CEFD60F84EA7" xml:space="preserve">// Define the interface UIDs |
|
24 const TImplementationProxy ImplementationTable[] = |
|
25 { |
|
26 {{0x10009DC3}, CImplementationClassOne::NewL();}, |
|
27 {{0x10009DC4}, CImplementationClassTwo::NewL();} |
|
28 }; |
|
29 }</codeblock> </stepxmp> |
|
30 </step> |
|
31 <step id="GUID-D465B0AD-350A-597F-A0AB-D71F44F1CAEB"><cmd/> |
|
32 <info>The signature of this exported function must be: </info> |
|
33 <stepxmp><codeblock id="GUID-847AC15E-6714-5399-827C-2C04423A8CE7" xml:space="preserve">const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount);</codeblock> </stepxmp> |
|
34 </step> |
|
35 <step id="GUID-43C85534-AD27-5F72-A57E-5271397C1C21"><cmd/> |
|
36 <info>The exported function returns a pointer to an array of <xref href="GUID-A91AD391-D638-3FD4-93E3-B77B85767CCD.dita"><apiname>TImplementationProxy</apiname></xref> objects. </info> |
|
37 </step> |
|
38 <step id="GUID-D66DC4B4-3B8A-59CF-A74E-2FE499F5CA83"><cmd/> |
|
39 <info>Each <codeph>TImplementationProxy</codeph> contains a UID and a function |
|
40 pointer. </info> |
|
41 <info> <codeph>aTableCount</codeph> should be set to the number of items in |
|
42 the array. </info> |
|
43 <stepxmp><codeblock id="GUID-2AAD649D-BC66-55B1-9EA1-9C30CF96BB4B" xml:space="preserve">EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
44 { |
|
45 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
46 |
|
47 return ImplementationTable; |
|
48 }</codeblock> </stepxmp> |
|
49 </step> |
|
50 </steps> |
|
51 </taskbody></task> |