Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to export the implementation factories

An interface implementation collection gathers one or more interface implementations in a DLL and provides necessary information for ECom to use them. The collection must export a single function that provides an array that maps a UID for each implementation to its respective creation function.

The signature of this exported function is:

const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount);

It returns a pointer to an array of TImplementationProxy objects. Each TImplementationProxy contains a UID and function pointer. aTableCount should be set to the number of items in the array.

This presence and form of the function is enforced at build time by the TARGETTYPE specification in the project file.

Example

The following example declares an array for a collection containing two implementations, and an appropriate exported function.

// Define the interface UIDs
const TImplementationProxy ImplementationTable[] = 
    {
    {{0x10009DC3}, CImplementationClassOne::NewL},
    {{0x10009DC4}, CImplementationClassTwo::NewL}
    };

EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
    {
    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);

    return ImplementationTable;
    }

Note

The UID in the array must be the same as the implementation_uid for the implementation in its registration resource file.