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!

managed, unmanaged

#pragma managed 
#pragma unmanaged

Using the /com+ compiler option provides module-level control for compiling functions either as managed or unmanaged. Using the managed and unmanaged pragmas enable function-level control for compiling functions managed or unmanaged.

An unmanaged function will be compiled for the native platform and execution of that portion of the program will be passed to the native platform by the runtime.

Functions are managed by default when /com+ is used. The compiler ignores the managed or unmanaged pragmas if /com+ is not used in the compilation.

Example

// compile with /com+
#using <mscorlib.dll>

#pragma unmanaged
static void func1(void) {
   __asm {
      nop
   }
}

// func2 is unmanaged
static void func2(void) {   // ok
   __asm {
      nop
   }
}

#pragma managed
// main is managed
void main() {
}

See Also

Pragma Directives