Exporting the Implementation Factories

An implementation collection gathers one or more interface implementations in a DLL. It provides necessary information to the plug-in framework to use them. The collection must export a single function that provides an array. This array maps the UID of each implementation it contains with a pointer to its factory instantiation function (NewL() in our example).


  1. Define a UID for each implementation. This UID maps to the instantiation function of the implementation. Construct an array of UID's for all the implementations in the collection.
            
             
            
            // Define the interface UIDs
    const TImplementationProxy ImplementationTable[] = 
        {
        {{0x10009DC3}, CImplementationClassOne::NewL();},
        {{0x10009DC4}, CImplementationClassTwo::NewL();}
        };
        }
           

  2. The signature of this exported function must be:
            
             
            
            const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount);
           

  3. The exported function returns a pointer to an array of TImplementationProxy objects.

  4. Each TImplementationProxy contains a UID and a function pointer. aTableCount should be set to the number of items in the array.
            
             
            
            EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
        {
        aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
    
        return ImplementationTable;
        }