Hi,
While building a static interface DLL, I have a base class defined as -
class CTestBase : public CBase
{
public:
// new functions
IMPORT_C static CTestBase * NewL();
IMPORT_C virtual TInt GetChildID() = 0;
IMPORT_C virtual ~CTestBase ();
}
class CTestChild : public CTestBase
{
static CTestChild * NewL();
~CChildMapTp();
TInt GetChildID();
TInt GetServiceId();
}
//CTestBase.cpp
EXPORT_C CTestBase * NewL()
{
//returns child instance
CTestChild* self = CTestChild::NewL();
return self;
}
//CTestChild.cpp
//Implements NewL() and other functions...but does not EXPORT_C any of them
TInt CTestChild::GetChildID()
{
}
TInt CTestChild::GetServiceId()
{
}
//Application using the DLL
MainUseDLL()
{
CTestChild* iChild = (CTestChild*)CTestBase::NewL();
iChild ->GetChildID() ; //Works as it has Import_C in the base class.
iChild->GetServiceId() ; //Gives linker error undefined GetSrviceId..
}
My question is, since I have the pointer to the child object, as per C++ i should be able to call GetServiceId(). but does not work unless i EXPORT_C it. I did see that the def files were updated with GetSrviceId only after Exporting it in the child class.
Is this the expected behavior? Do we need to export the additional interfaces in child class too to get access to the child class interface from an application using the DLL?
In Windows we are able to access the child class interface without dll exporting them. Does the behavior differ in Symbian?

Reply With Quote

