NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C3741

'class': must be a coclass when the 'layout_dependent' parameter of event_receiver = true

When layout_dependent=true for an event_receiver class, then the class must also have the coclass attribute.

The following sample generates C3741

#define _ATL_ATTRIBUTES 1
#include <atlbase.h>
#include <atlcom.h>
[module(name="xx")];

[object] 
__interface I { 
HRESULT f(); 
};

[ event_receiver(com, layout_dependent=true)]
// class or struct must be declared with coclass
// [ event_receiver(com, layout_dependent=true), coclass]
struct R : I {   // C3741
        HRESULT f() { return 0; }
        R() {}
        R(I* a) {
                __hook(I, a);
        }
};