开发者

What do the statements "#pragma managed(push, off)" and "#pragma managed(pop)" mean?

I am looking at some C++/CLI code and have seen a lo开发者_运维问答t of such statements mostly around #includes. What do they mean? I know that they, according to MSDN, Enable function-level control for compiling functions as managed or unmanaged. But I am interested in their inner mechanics especially the push and pop semantics. If someone could explain how either one of the two statements works, I will figure out the other one myself.


#pragma managed(push, off)

Sets managed compilation option to the code after this line to off, and pushes to the stack previously active managed option.

#pragma managed(pop)

Restores last managed state from the stack. Code between these two lines is compiled as unmanaged. Code after pop line is compiled with the same option, as before the push line, whether it was managed or unmanaged.


It tells the C++ compiler, when used with the /clr switch, to create those methods between a push and pop as managed code.

http://msdn.microsoft.com/en-us/library/0adb9zxe(v=vs.80).aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜