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 C3718

can only call 'event' in the context of a member function of the receiving class

The event can only be called from the receiving class.

The following sample generates C3718:

[event_source(native)]
struct A {
        __event void func();
};

[event_receiver(native)]
struct B {
   void func2();
   void HOOK(A* pa) {
   __hook(&A::func, pa, &B::func2);         // valid call 
   }
};

void main() {
   A a;
   B b;
   __hook(&A::func, &a, &B::func2, &b);   // C3718, remove this line to resolve the error
   a.func();
}