Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


How to define the interface to a polymorphic interface DLL

The following example code illustrates the use of 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.

[Top]


Notes:

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