To use a plug-in, the client of the plug-in framework needs to instantiate an object through the interface definition, use the object and delete the object when the scope of the object usage is complete. Client calls to the interface definition for construction and destruction translate directly through REComSession into loading and unloading of the correct implementation.
The interface definition defines functions that offer services to the clients and enable object instantiation. The object instantiation functions uses the plug-in framework to create an instance of an appropriate implementation, and returns the instance to the client.
A function in the interface definition delegates the object instantiation to a static function REComSession::CreateImplementationL() . The REComSession::CreateImplementationL() is an overloaded function and offers many input parameter options. The appropriate REComSession::CreateImplementationL() function is called for object instantiation. If the client passes input data then this data must be wrapped in a TEComResolverParams object.
The interface definition needs to define a destructor function to destroy the object after use. The interface destructor notifies the plug-in framework about the object destruction.
The destructor of the interface definition must call the static function REComSession::DestroyedImplementation() to signal the object destruction to plug-in framework. The instance identifier key is passed as a input parameter to REComSession::DestroyedImplementation() to identify the instance.
inline CExampleInterfaceDefinition::~CExampleInterfaceDefinition() { REComSession::DestroyedImplementation(iDtor_ID_Key); }
Note: The memory clean-up functionREComSession::FinalClose() should not be invoked inside the destructor, or elsewhere in the interface. For more details refer the topic Cleaning-up Memory.