diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-6D6DFC3A-8940-531A-A319-922317D19B51.dita --- a/Symbian3/PDK/Source/GUID-6D6DFC3A-8940-531A-A319-922317D19B51.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-6D6DFC3A-8940-531A-A319-922317D19B51.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,49 +1,49 @@ - - - - - -How to -define the interface to a polymorphic interface DLLExplains how to use a polymorphic interface DLL. -

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 CMessenger.

-class CMessenger : public CBase - { -public: - virtual void ConstructL(CConsoleBase* aConsole, const TDesC& aName)=0; - virtual void ShowMessage()=0; -private: - CConsoleBase* iConsole; - HBufC* iName; - }; - -// The UID for Messenger DLLs. -// The client imposes this on DLLs which satisfy the protocol. - -const TInt KMessengerUidValue=0x10004262; -const TUid KMessengerUid={KMessengerUidValue}; -

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.

-
Notes:

Because the API can be implemented differently -in different DLLs, note the following when declaring the class:

    -
  • 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 new (ELeave) semantics.

  • -
  • All functions are pure -virtual; a DLL must provide an implementation for all such functions.

  • -
  • All functions are public since -the published API is all there to be used, there is no need for private specifications.

  • -
  • It is possible to use -polymorphic interface DLLs in a more advanced way that allows some of these -rules to be changed.

  • -
+ + + + + +How to +define the interface to a polymorphic interface DLLExplains how to use a polymorphic interface DLL. +

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 CMessenger.

+class CMessenger : public CBase + { +public: + virtual void ConstructL(CConsoleBase* aConsole, const TDesC& aName)=0; + virtual void ShowMessage()=0; +private: + CConsoleBase* iConsole; + HBufC* iName; + }; + +// The UID for Messenger DLLs. +// The client imposes this on DLLs which satisfy the protocol. + +const TInt KMessengerUidValue=0x10004262; +const TUid KMessengerUid={KMessengerUidValue}; +

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.

+
Notes:

Because the API can be implemented differently +in different DLLs, note the following when declaring the class:

    +
  • 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 new (ELeave) semantics.

  • +
  • All functions are pure +virtual; a DLL must provide an implementation for all such functions.

  • +
  • All functions are public since +the published API is all there to be used, there is no need for private specifications.

  • +
  • It is possible to use +polymorphic interface DLLs in a more advanced way that allows some of these +rules to be changed.

  • +
\ No newline at end of file