Re: exportdll DLL



On 26 Jul 2006 19:33:22 -0700, "Ajay Kalra" <ajaykalra@xxxxxxxxx> wrote:

I dont know how that will happen. If CMetadata is not exported, there
will be a link time failure as the client DLL will not be able to find
the class in any of the libraries its linking against. I guess the only
way it can succeed is if you force a compile (not recommended)
regardless.

I did say I couldn't explain the OP's observation unless one of the two
scenarios I listed applied. :) What I said about "inline" was a bit of a
stretch, since an inline function doesn't really belong to any module; I
guess I thought of it because the header it appears in is considered part
of the module's interface. The virtual function issue is more interesting.
Suppose you have the OP's class CMetaData:

class CMetaData
{
public:

virtual void f();
};

Per the OP's message, another class X (presumably exported) creates a
CMetaData and returns a pointer to it to another module. Now that other
module can call p->f(), even though CMetaData::f isn't exported. What it
can't do is say p->CMetaData::f(), because that disables the virtual call
mechanism and causes the compiler to bind to f's actual address. So, the
OP's observation could be explained if the CMetaData::GetValue in his
actual code is a virtual function.

--
Doug Harrison
Visual C++ MVP
.



Relevant Pages

  • RE: [newbie][long]Pure virtual function call :(
    ... > I'm Visual C++ 6 newbie. ... I'm trying to compile some simple ... >: see declaration of 'QueryInterface' ... > virtual function was not defined ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Compile Error on Propputref
    ... > When i compile with this method it produces the following error ... But when i change propputref to propput it compiles ok. ... > cannot instantiate abstract class ... > virtual function was not defined ...
    (microsoft.public.vc.atl)
  • RE: [newbie][long]Pure virtual function call :(
    ... I'm trying to compile some simple ... >: see declaration of 'QueryInterface' ... > virtual function was not defined ... > pure virtual function was not defined ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Undefined reference to vtable
    ... Karl Ebener wrote: ... > I have created a program using several classes with inheritage. ... > compile and link, ... A call to virtual function shouldn't go through vtable, ...
    (comp.lang.cpp)