I'm trying to use an pointer to a base class in a dll passed in by the
exe. In VC7 I keep getting runtime exception relating to how the
"function pointer" was declared. Can someone help?
It seems that this would be a very common thing to do.
I'm not sure I've found the right news group, sorry if I haven't.
What I'm doing is:
dll.h:
class __declspec(dllexport) CVirtualBaseClass
{
public:
virtual bool func1() = 0;
};
__declspec(dllexport) void DoSomethingWithObject(CVirtualBaseClass*
pVBC);
dll.cpp:
void DoSomethingWithObject(CVirtualBaseClass* pVBC)
{
pVBC->func1(); //this get's exception upon return.
}
exe.cpp:
#include dll.h
class CImplementation : public CVirtualBaseClass
{
public:
virtual bool func1()
{
return true;
}
};
void DoSomethingWithDll
{
DoSomethingWithObject(new CImplementation);
}
Thanks,
Andy