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 C3604

'object': can only create an instance of a NGWS runtime managed class on the managed heap

You cannot declare objects to managed classes on the stack.

The following sample generates C3604:

#using <mscorlib.dll>

[coclass]
__gc class B {
public:
   int i;
   ~B() {
   }
};

void main() {
   B b;   // C3604

/* the following works
   B *b2 = new B;
   B *b3;
   b2 = b;
   b->i = 99;

   Console::Out->WriteLine(b2->i);
   Console::Out->WriteLine(b->i);
   b2->i = 66;
   Console::Out->WriteLine(b2->i);
   Console::Out->WriteLine(b->i);
*/
}