A polymorphic interface DLL is one which is written to implement a programming interface defined elsewhere; for example, a device driver, an application or an OPL extension.
The API is defined in terms of a single abstract class whose functions are declared as pure virtual. The DLL implements the API by defining and implementing a concrete class derived from that abstract class. The DLL exports a single function whose sole purpose is to create an object of the derived class type; this is always the function at ordinal 1 within the DLL. All other functions in the DLL are called through the virtual table mechanism (the pointer to the vtable is set up by the constructor in the normal C++ way).
At compilation time, application code includes the header file(s) which define(s) the API. At link time, the application includes the DLL's module definition file, which allows the address of the DLL function to be accessed by specifying its ordinal.
When the application's executable runs, it loads the DLL at the time it is required. The address of the single function exported by the DLL is accessed indirectly by specifying its ordinal.
For a given interface, there may be many DLLs which obey the protocol imposed by that interface each of which provides a different implementation.
A DLL of this type is often referred to as a dynamically loaded DLL.
The user of a dynamically loaded DLL uses an RLibrary type object to load the DLL. The RLibrary object encapsulates a handle to the DLL and must remain in existence while the DLL is in use; typically this is for the life of the object provided by the DLL.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.