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 ...
随机推荐
- tyvj P4879骰子游戏-美国70分
需要FFT优化... #include<iostream> #include<cstdio> #include<queue> #include<vector& ...
- 用于<挣值管理>的各种指标计算
PV(Planning Value) 含义:计划价值,截至到某个时间计划工作经批准的成本预算. 公式:PV=计划工作数X计划单价. BAC 含义:完工预算,截至到完工时间计划工作经批准的成本预算,即完 ...
- JavaScript笔记5-事件
一.概述: 事件是可以被JavaScript侦测到的行为.网页中的每个元素都可以产生某些可以触发JavaScript函数的事件.相当于让标签在满足某种条件的时候,调用指定的方法. 二.常用事件 1:o ...
- Js中的字符串/数组中常用的操作
JS为每种数据类型都内置很多方法,真的不好记忆,而且有些还容易记混,现整理如下,以便以后查看: 一.String ①charAt()方法用于返回指定索引处的字符.返回的字符是长度为 1 的字符串. 语 ...
- 初识RatingBar
RatingBar,SeekBar和ProgressBar的子类 <RatingBar android:id="@+id/ratingBar2" android:layout ...
- BaseAdapter.notifyDataSetChanged()之观察者设计模式及源码分析
BaseAdapter.notifyDataSetChanged()的实现涉及到设计模式-观察者模式,详情请参考我之前的博文设计模式之观察者模式 Ok,回到notifyDataSetChanged进行 ...
- put_user
1. put_user Name put_user -- Write a simple value into user space. Synopsis put_user ( x, ptr); A ...
- datatables添加长按事件
长按事件 $.fn.longPress = function (fn) { var timeout = undefined; var $this = this; for (var i = 0; i & ...
- 小目标 | Power BI新人快速上手手册
· 适用人群:数据分析专业人士,在数据分析方向需求发展人士 · 应用场景:数据汇报.数据可视化展现.数据建模分析 · 掌握难度:★★★★☆ 本期讲师 『PowerPivot工坊』公众号提供Power ...
- Jmeter进行接口的性能测试
一.录制Jmeter脚本 录制Jmeter脚本有两种方法,一种是设置代理:一种则是利用badboy软件,badboy软件支持导出jmx脚本. 这里我们介绍第二种方法,利用badboy录制脚本,然后导出 ...