Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Defining a custom ECOM interface

From Wiki
Jump to: navigation, search
Article Metadata
Code Example
Source file:
Tested with
Devices(s): Nokia N95
Platform(s): S60 3rd Edition, FP1
Keywords: REComSession, TEComResolverParams
Created: tepaa (20 Feb 2008)
Last edited: hamishwillee (30 May 2013)



This code snippet demonstrates how to define an interface for an ECom component. Clients use the interface to get an instance of the concrete implementation, and plug-ins implement the pure virtual SayHello(TDes& aString) method.

Preconditions and important issues

  • Due to self-signing, the UID of this interface must be from the unprotected range.
  • If the UID3 of the plug-in DLL is changed (and, correspondingly, the name of the RSS file is changed), the ECom framework may not find the plug-in with the new UID. It may be necessary to delete the ECom.ROM.Z.dat and Ecom.idx files from the development environment folder of the SDK (for example, C:\Symbian\9.1\S60_3rd_MR\Epoc32\winscw\c\private\10009D8F\). When the emulator is restarted, the files are recreated.
  • The interface header must have a unique instance identifier key (iDtor_ID_Key).
  • The interface must inform the ECom framework that this specific instance of the interface has been destroyed: REComSession::DestroyedImplementation(iDtor_ID_Key).

MMP file

No MMP file is needed. Only the header and inline source files are defined. ECom components that derive this base class must include these two files.

Header file

#include <e32base.h>
#include <ECom.h>
#include "HelloEcomIF.inl" // Proprietary base implementations for ECOM
class CHelloEcomIF : public CBase
// Instantiates an object of this type
static CHelloEcomIF* NewL();
// Destructor
virtual ~CHelloEcomIF();
// Requests a list of all available implementations which follow this
// given interface.
static void ListAllImplementationsL(RImplInfoPtrArray& aImplInfoArray);
// Your own pure interface method which the derived class must implement
virtual void SayHello(TDes& aString) = 0;
inline CHelloEcomIF();
// Unique instance identifier key
TUid iDtor_ID_Key;

Inline source file

inline CHelloEcomIF* CHelloEcomIF::NewL()
// Finds an ECom with a given implementation UID (KCHelloEcomImplUid)
// and casts it to CHelloEcomIF*
// There are many different solutions to find EComs but this is the
// simplest. The example uses the default resolver.
inline CHelloEcomIF::~CHelloEcomIF()
// Destroy any instance variables and inform the framework that
// this specific instance of the interface has been destroyed.
inline void CHelloEcomIF::ListAllImplementationsL
(RImplInfoPtrArray& aImplInfoArray)
REComSession::ListImplementationsL(KCHelloEcomIFUid, aImplInfoArray);

ECom plug-in resource file

KCHelloEcomImplUid implementation UID for finding the particular ECom component is stated in the ECom resource file ({{{1}}}).

#include "RegistryInfo.rh"
// UID for the DLL
dll_uid = 0xE01F5465;
// Declare an array of interface information
interfaces =
// UID of the interface that is implemented
interface_uid = 0xE0009DC1;
implementations =
// Info for implementation of CHelloEcomIF
implementation_uid = 0xE0009DC7;
version_no = 1;
display_name = "ecomexample";
opaque_data = "";
default_data = "ecomexample";


ECom class header and inline file (or source file) have been defined. The header has at least a constructor, a destructor, and some virtual methods that the derived class must implement.

See also

This page was last modified on 30 May 2013, at 04:37.
97 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.