Compiler Error C3743
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3743.
can only hook/unhook an entire interface when the 'layout_dependent' parameter of event_receiver is true
The __unhook function varies in the number of parameters that it takes based on the value passed to the layout_dependent parameter in the event_receiver class.
The following sample generates C3743:
// C3743.cpp
#define _ATL_ATTRIBUTES 1
#include <atlbase.h>
#include <atlcom.h>
[module(name="xx")];
[object] __interface I { HRESULT f(); };
[event_receiver(com, layout_dependent=true), coclass]
struct R : I {
HRESULT f() {
return 0;
}
R() {
}
R(I* a) {
__hook(I, a, &R::f); // C3743
// The following line resolves the error.
// __hook(I, a);
}
};
Show: