问题描述
我想知道如果C#项目设置允许不安全的代码只适用于不安全的C#代码项目本身,还是有必要设置一个本地C ++ DLL链接时,这个选项?怎么样在自身链接到本机DLL托管DLL链接?这是什么选项真的这么做了,引擎盖下?
I was wondering if the C# project setting "Allow unsafe code" applies only to unsafe C# code in the project itself, or is it necessary to set this option when linking in a native C++ DLL? What about linking in a managed DLL that itself links to a native DLL? What does this option really do, under the hood?
推荐答案
它与C#中的不安全的关键字做。 不安全关闭所有,通常会发生,使您可以直接访问内存中的检查。它并不是指调用本地C ++ DLL的或接口。
It has to do with the "unsafe" keyword in C#. "unsafe" turns off all the checks that would normally happen and allow you to directly access the memory. it doesn't refer to calling native C++ DLL's or interfaces.
这篇关于什么是C#项目设置"的实际功能;允许不安全的代码"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!