Private Virtual Functions.
| Wed, 2008-02-20 16:37 | |
|
Hi, I dont know how silly this question might be, but i am getting class RTestServ : public REikAppServiceBase class RScriptTestServ : public RTestServ The function is implemented in all the classes also all three classes are in separate dlls. EXPORT_C void classname::ExtensionInterface(TUid /*aInterfaceId*/, TAny*& /*aImplementaion*/) } When i compile this, i get a linker error: I dont understand why the vftable of REikAppServiceBase in RScriptTestServ class file point to a function which is private.? Thanks in Advacne, |
|






Forum posts: 32
Hi,
The ExtensionInterface function is not pure virtual in the base class, so you should not even implement it in your derived class if you don't know what it should do. Basically it is a place for the platform developers to extend the base class without breaking binary compatibility.
The reason why the virtual function is exported from the class is that if derived classes implement the virtual function, they probably should call the base class implementation from their implementation. In that case call would be REikAppServiceBase::ExtensionInterface(aInterfaceId, aImplementation) which will be resolved statically instead of being a virtual function call. Because the call is resolved statically, it does not go through the virtual function calling mechanism, and that is why the virtual function must be in the DLL interface as well.
In any case, I think you have to link against the lib file that defines REikAppServiceBase, because you will need its constructor and destructor from there.
Jari
Forum posts: 6
Hi Jari,
This is exactly what i had thought when writing the classes RTestServ and RScriptTestServ. I dint even bother abt the function. But it still gived me the same linker error "Undefined symbol: 'void REikAppServiceBase::ExtensionInterface...." along with 2 other errors "Undefined symbol: void RTestServ ::ExtensionInterface" and "Undefined symbol: void RScriptTestServ ::ExtensionInterface" in the file where RScriptTestServ is defined. Thats why i had to implement that function and export it in my 2 classes. So the last 2 errors were resolved but then the first one remains again. The weird thing is how can the vftable of REikAppServiceBase in RScriptTestServ class file point to a function that is private in the base class. Do you think its possible? or a design issue with class?
Forum posts: 6
It compiles for armv5 urel. Not for emulator . May be emulator linker is screwed?