managed unmanaged
Enable function-level control for compiling functions as managed or unmanaged.
#pragma managed
#pragma unmanaged
#pragma managed([push,] on | off)
#pragma managed(pop)
The /clr compiler option provides module-level control for compiling functions either as 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 common language runtime.
Functions are compiled as managed by default when /clr is used.
Use the following guidelines when applying these pragmas:
Add the pragma preceding a function but not within a function body.
Add the pragma after #include statements (do not use these pragmas before#include statements).
The compiler ignores the managed and unmanaged pragmas if /clr is not used in the compilation.
When a template function is instantiated, the pragma state at the time of definition for the template determines if it is managed or unmanaged.
For more information, see Initialization of Mixed Assemblies.
// pragma_directives_managed_unmanaged.cpp
// compile with: /clr
#include <stdio.h> // func1 is managed
void func1() {
System::Console::WriteLine("In managed function.");
} // #pragma unmanaged
// push managed state on to stack and set unmanaged state
#pragma managed(push, off) // func2 is unmanaged
void func2() {
printf("In unmanaged function.\n");
} // #pragma managed
#pragma managed(pop) // main is managed
int main() {
func1();
func2();
}
In managed function.
In unmanaged function.
managed unmanaged的更多相关文章
- Investigating issues with Unmanaged Memory. First steps. (转载)
原文:http://kate-butenko.blogspot.tw/2012/07/investigating-issues-with-unmanaged.html I want to write ...
- 《Walking the callstack(转载)》
本文转载自:https://www.codeproject.com/articles/11132/walking-the-callstack Download demo project with so ...
- Windbg使用简明指南
第一章 准备 1.1. 环境配置 _NT_DEBUGGER_EXTENSION_PATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 _NT_SY ...
- Gumshoe - Microsoft Code Coverage Test Toolset
Gumshoe - Microsoft Code Coverage Test Toolset 2014-07-17 What is Gumshoe? How to instrument a binar ...
- Chapter 6 — Improving ASP.NET Performance
https://msdn.microsoft.com/en-us/library/ff647787.aspx Retired Content This content is outdated and ...
- C#使用MiniDump捕获异常
c/c++语言里MiniDump是一个重要的调试手段,他们没有C#/java这样语言有很多异常输出信息( JVM异常导出bug日志功能,通常在jdk目录,文件格式hs_err_%pid%.log,pi ...
- Rewrite MSIL Code on the Fly with the .NET Framework Profiling API
http://clrprofiler.codeplex.com/ http://blogs.msdn.com/b/davbr/archive/2012/11/19/clrprofiler-4-5-re ...
- Jetty - Container源码分析
1. 描述 Container提供管理bean的能力. 基于Jetty-9.4.8.v20171121. 1.1 API public interface Container { // 增加一个bea ...
- C# .Net Framework4.5中配置和使用managedCUDA及常见问题解决办法
主要参考英文帖子.我就不翻译了哈.很容易懂的. 先说明我的运行平台: 1.IDE:Visual Studio 2012 C# .Net Framework4.5,使用默认安装路径: 2.显卡类型:NV ...
随机推荐
- Java基础语法(数组)
第4天 Java基础语法 今日内容介绍 u 流程控制语句(switch) u 数组 第1章 流程控制语句 1.1 选择结构switch switch 条件语句也是一种很常用的选择语句,它和if条件语句 ...
- ABAP数据转换规则
数据转换规则: 可以将基本数据类型的源字段内容赋给其它基本数据类型的目标字段(除了数据类型 D 无法赋给数据类型 T,反之亦然).ABAP/4 也支持结构化数据和基本数据对象之间或结构不同的数据对象之 ...
- JavaWeb_03_JavaScript学习小结1
1.javascript的简介 是基于对象和事件驱动的语言,应用于客户端. 基于对象: 提供好了很多对象,可以直接拿过来使用 事件驱动: html做网站静态效果,javascript动态效果 客户端: ...
- JS根据选择的日期计算年龄
本例中用的是easyUI的datebox $('#cal_birthday').datebox({ onSelect: function(date){ //根据选则的日期计算年龄 //alert(da ...
- GIT新手入门学习教程
廖雪峰的GIT教程 链接地址:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
- 分享eclipse自动生成java注释方法
设置方法介绍: eclipse中:Windows->Preferences->Java->Code Style->Code Template->Comments,然后对应 ...
- centos7使用yum安装不了ffmpeg
[root@localhost]# yum install ffmpeg Loaded plugins: fastestmirror Loading mirror speeds from cached ...
- 内容导出成word
private void 导出word(string 内容) { string tit = "<html xmlns:v=\"urn:schemas-microsoft-co ...
- Codevs 1860 最大数
题目描述 Description 设有n个正整数(n≤20),将它们联接成一排,组成一个最大的多位整数. 输入描述 Input Description 第一行一个正整数n. 第二行n个正整数,空格隔开 ...
- db2疑难解决
http://www-01.ibm.com/support/knowledgecenter/?lang=zh#!/SSEPGG_9.5.0/com.ibm.db2.luw.messages.sql.d ...