Dllimport属性的内部工作 [英] Internal working of Dllimport attribute

查看:48
本文介绍了Dllimport属性的内部工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

当我们使用[DllImport("x.dll")]时到底发生了什么.

预先感谢

Hi all,

what exactly happening when we are using [DllImport("x.dll")].

Thanks in advance

推荐答案

在托管应用程序中重用现有非托管代码时,DllImport属性非常有用.例如,您的托管应用程序可能需要调用非托管WIN32 API.
参考链接:-
http://msdn.microsoft.com/en-us/library/aa984739 (v = vs.71).aspx [ http://msdn.microsoft.com/zh-CN -us/library/system.runtime.interopservices.dllimportattribute(v = vs.71).aspx [使用DllImport进行交易(第2部分,共1部分) [处理DllImport,(第2部分,共2部分) [
The DllImport attribute is very useful when reusing existing unmanaged code in a managed application. For instance, your managed application might need to make calls to the unmanaged WIN32 API.
Reference Link :-
http://msdn.microsoft.com/en-us/library/aa984739(v=vs.71).aspx[^]
http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute(v=vs.71).aspx[^]

Dealing with DllImport (Part 1 of 2)[^]
Dealing with DllImport, (Part 2 of 2)[^]


尽管.NET框架封装了Win32 API的很大一部分,有时仍然需要使用DllImport属性从托管代码中调用API,这可能会变得很复杂.

http://msdn.microsoft.com/en-us/library/aa288468 (v = vs.71).aspx [
Although the .NET framework encapsulates a large portion of the Win32 API, it''s sometimes still necessary to call the API from your managed code using the DllImport attributeand that can get complicated.

http://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx[^]


这篇关于Dllimport属性的内部工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆