Suppose I have a third-party DLL which exposes functionality via a class Foo
. Foo
expects me to provide callbacks by means of defining a class implementing the interface IBar
.
I need to call into this third-party DLL from a DLL I have created, which is in turn called from a core executable. So my DLL contains code like this:
class MyBar : public IBar
{
public:
// Implement the Frobble method of IBar
virtual void Frobble() override
{
// ...callback code here...
}
};
// Entry point from core executable
extern "C" __declspec(dllexport) void DoStuff()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
MyBar myBar;
Foo thirdPartyFoo;
thirdPartyFoo(myBar);
}
Do I need to call AFX_MANAGE_STATE
again inside MyBar::Frobble
?