C#调用C++的库 P/Invoke工具集

简介: p/Invoke可以使用工具辅助自动生成,以减少混淆 1、官方的支持 http://visualstudiogallery.msdn.microsoft.com/site/search?query=p%2Finvoke&f%5B0%5D.

p/Invoke可以使用工具辅助自动生成,以减少混淆

1、官方的支持

http://visualstudiogallery.msdn.microsoft.com/site/search?query=p%2Finvoke&f%5B0%5D.Value=p%2Finvoke&f%5B0%5D.Type=SearchText&ac=4

微软的官方扩展上也有很多

开源的工具

http://www.pin5i.com/showtopic-22763.html

看起来微软自己也是深受.NET蹩脚的P/Invoke支持的毒害,因此无奈之余发布P/Invoke Interop Assistant工具,你可以去下面这个链接来下载这个工具:
http://download.microsoft.com/download/f/2/7/f279e71e-efb0-4155-873d-5554a0608523/CLRInsideOut2008_01.exe

实际上这个工具已经开源了,你可以从这里http://www.codeplex.com/clrinterop/下载到它的源代码

2、经典的讨论区 

http://stackoverflow.com/questions/2495632/easiest-way-to-generate-p-invoke-code

http://www.paulyao.com/res/pinvoke/pinvoke.aspx

3、社区评论

http://through-the-interface.typepad.com/through_the_interface/2011/04/pinvoke-tools.html

 

The first tool is the PInvoke Visual Studio Add-in from Red Gate Software (the UK-based provider of various development tools, including Reflector Pro). It appears to be a Visual Studio Add-in for VS2003 and 2005 (I can’t see an update for VS2008 or 2010, which also means I can’t try it). The tool provides simplified access to the excellent PInvoke.net website, to which I often refer when developing .NET apps. I don’t actually use that many P/Invoke statements that I feel I need an Add-In, though – which is perhaps why the add-in doesn’t appear to have been updated for more recent Visual Studio versions – but it seemed worth mentioning.

 

PInvoke Visual Studio Add-in menu itemPInvoke Visual Studio Add-in dialog

 

The second – in my opinion more interesting – tool is the P/Invoke Interop Assistant(here’s a more in-depth articlethe CodePlex hosting site and a Channel 9 interview with one of the authors). This tool generates P/Invoke signatures for use from C# and VB.NET, as well as the ability to determine the P/Invoke signatures used in compiled binaries:

 

  • Generating P/Invoke declarations while searching for commonly-used (presumably Win32) functions, structures, messages, etc.

 

相关文章
|
3月前
|
XML 网络协议 API
超级好用的C++实用库之服务包装类
通过本文对Boost.Asio、gRPC和Poco三个超级好用的C++服务包装类库的详细介绍,开发者可以根据自己的需求选择合适的库来简化开发工作,提高代码的效率和可维护性。每个库都有其独特的优势和适用场景,合理使用这些库可以极大地提升C++开发的生产力。
78 11
|
6月前
|
算法 C++ 容器
C++标准库(速查)总结
C++标准库(速查)总结
151 6
|
6月前
|
存储 程序员 C++
C++常用基础知识—STL库(2)
C++常用基础知识—STL库(2)
112 5
|
6月前
|
存储 自然语言处理 程序员
C++常用基础知识—STL库(1)
C++常用基础知识—STL库(1)
119 1
|
6月前
|
存储 消息中间件 NoSQL
Redis 入门 - C#.NET Core客户端库六种选择
Redis 入门 - C#.NET Core客户端库六种选择
151 8
|
6月前
|
存储 算法 C++
C++ STL 初探:打开标准模板库的大门
C++ STL 初探:打开标准模板库的大门
168 10
|
7月前
|
编译器 API C语言
超级好用的C++实用库之跨平台实用方法
超级好用的C++实用库之跨平台实用方法
83 6
|
7月前
|
缓存 网络协议 Linux
超级好用的C++实用库之套接字
超级好用的C++实用库之套接字
71 1
|
7月前
|
安全 C++
超级好用的C++实用库之环形内存池
超级好用的C++实用库之环形内存池
144 5
|
7月前
|
存储 算法 安全
超级好用的C++实用库之国密sm4算法
超级好用的C++实用库之国密sm4算法
219 0

热门文章

最新文章