Symbian3/SDK/Source/GUID-6D6DFC3A-8940-531A-A319-922317D19B51.dita
changeset 0 89d6a7a84779
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-6D6DFC3A-8940-531A-A319-922317D19B51.dita	Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License 
+"Eclipse Public License v1.0" which accompanies this distribution, 
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+    Nokia Corporation - initial contribution.
+Contributors: 
+-->
+<!DOCTYPE concept
+  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-6D6DFC3A-8940-531A-A319-922317D19B51" xml:lang="en"><title>How to
+define the interface to a polymorphic interface DLL</title><shortdesc>Explains how to use a polymorphic interface DLL.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>The interface is defined by an abstract API which can be implemented by
+a DLL. The following code fragment defines the API in terms of a pure virtual
+abstract C++ class; this is an example class called <codeph>CMessenger</codeph>.</p>
+<codeblock id="GUID-68199E32-6801-5964-9B3E-56DAB3369E41" xml:space="preserve">class CMessenger : public CBase
+    {
+public:
+    virtual void ConstructL(CConsoleBase* aConsole, const TDesC&amp; aName)=0;
+    virtual void ShowMessage()=0;
+private:
+    CConsoleBase* iConsole;
+    HBufC*        iName;
+    };</codeblock>
+<codeblock id="GUID-039AF89C-AF41-5F69-AA47-8A0D66DBAAB7" xml:space="preserve">
+// The UID for Messenger DLLs.
+// The client imposes this on DLLs which satisfy the protocol.
+
+const TInt KMessengerUidValue=0x10004262;
+const TUid KMessengerUid={KMessengerUidValue};</codeblock>
+<p>The purpose of the example is to be able to issue a simple greeting message.
+Any number of DLLs can be created, each containing a different implementation
+of the class.</p>
+<section id="GUID-6C3A1A07-6140-4A41-9E83-8348CDC81222"><title>Notes:</title> <p>Because the API can be implemented differently
+in different DLLs, note the following when declaring the class:</p> <ul>
+<li id="GUID-2D946F12-48A1-57B0-ADE0-7BF143DE6A8A"><p>The constructor is not
+declared; the default C++ constructor is used, and is not exported from the
+DLL. Instead, a function is exported from the DLL which constructs an object
+of the concrete type using <codeph>new (ELeave)</codeph> semantics.</p> </li>
+<li id="GUID-302202A4-DB5A-5A75-B036-9E664A915809"><p>All functions are pure
+virtual; a DLL <i>must</i> provide an implementation for all such functions.</p> </li>
+<li id="GUID-61D75525-ACA5-5419-AB64-323A5BB0EAFD"><p>All functions are <codeph>public</codeph> since
+the published API is all there to be used, there is no need for <codeph>private</codeph> specifications.</p> </li>
+<li id="GUID-A8CF8455-8860-5C64-BA75-FD3880DD8619"><p>It is possible to use
+polymorphic interface DLLs in a more advanced way that allows some of these
+rules to be changed.</p> </li>
+</ul> </section>
+</conbody></concept>
\ No newline at end of file