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 ...
随机推荐
- ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
最近遇到一个MySQL连接的问题,远程连接MySQL时遇到"ERROR 2013 (HY000): Lost connection to MySQL server at 'reading a ...
- webservice、soap、wsdl
搜集了一些关于webservice.soap.wsdl的基本知识,解决工作中遇到的疑问 一 .什么是webservice(用你的话描述webservice)?在什么时候用webservice(webs ...
- document.all.item作用
1.document.all.myCheckBox和 document.all.item通过控件的名字定位控件,item()中是控件的名字例如:<input type="checkbo ...
- JavaSe-算数运算符
算数运算符包括:+.-.*./.%.++.-- 代码: package com.java.chap02; public class Demo07 { public static void main(S ...
- POJ 1845 Sumdiv (数学,乘法逆元)
题意: 给出数字A和B,要求AB的所有因子(包括AB和1)之和 mod 9901 的结果. 思路: 即使知道公式也得推算一阵子. 很容易知道,先把分解得到,那么得到,那么的所有因子之和的表达式如下: ...
- UWP开发:应用设置存储
应用设置储存指的是保存在应用程序储存区中的键/值对的字典集合,它自动负责序列化对象,并将其保存在应用程序里.以键/值对方式提供一种快速数据访问的方式,主要用于储存一些应用信息. 1,简介 应用设置是W ...
- java面试题(杨晓峰)---以面试题为切入点,有效提升你的java内功
java是一门历史悠久的编程语言,可以毫无争议的说,java是最主流的编程语言之一.全球有1200万以上的java程序猿以及海量的设备,还有无所不能的java生态圈. 我所知道的诸如阿里,京东,百度, ...
- 禁止MySQL开机自动启动的方法
这几天发现电脑卡机变慢了,还有一些卡,发现每次开机MySQL都会自动启动(明明我安装的时候选择了不开机自启,任务管理器启动列表中也没有,但就是自启了...) 1.打开服务列表 有两种方法,一是快捷键 ...
- 剑指offer58 二叉树的下一个结点
自己写的 class Solution { public: TreeLinkNode* GetNext(TreeLinkNode* pNode) { if(pNode == NULL) return ...
- Tarjan 详解
Tarjan 算法 一.算法简介 Tarjan 算法一种由Robert Tarjan提出的求解有向图强连通分量的算法,它能做到线性时间的复杂度. 我们定义: 如果两个顶点可以相互通达,则称两个顶点强连 ...