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 C3825

'class': a managed class can only support NGWS runtime events

Only NGWS events are supported in managed classes. To fix the error, change type parameter of event_source and event_receiver from native to com+. Or remove the __gc from the class declarations so that they are not managed/garbage-collected classes.

The following sample generates C3825 (the code must be compiled with the /com+ compiler switch):

#using <mscorlib.dll>
#include <stdio.h>

[event_source(native)]           // To fix, change 'native' to 'com+'
                                 // or, remove __gc from class
__gc class CEventSrc {
public:
   __event void event1();        // C3825
};

[event_receiver(native)]         // To fix, change 'native' to 'com+'
                                 // or, remove __gc from class
__gc class CEventRec {
public:
   void handler1() {
      printf("Executing handler1().\n");
   }
   void HookEvents(CEventSrc* pSrc) {
      __hook(CEventSrc::event1, pSrc, CEventRec::handler1);
   }
   void UnhookEvents(CEventSrc* pSrc) {
      __unhook(CEventSrc::event1, pSrc, CEventRec::handler1);
   }
};

void main() {
   CEventSrc* pEventsrc = new CEventSrc;
   CEventRec* pEventRec = new CEventRec;
   pEventRec->HookEvents(pEventSrc);
   pEventSrc->event1();
   pEventRec->UnhookEvents(pEventSrc);
}