C#調用C++的庫 P/Invoke工具集

來源:互聯網
上載者:User

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

  • PInvoker: http://www.pinvoker.com
  • P/Invoke Interop Assistant: http://www.codeplex.com/clrinterop
  • P/Invoke Wizard: http://www.paulyao.com/res/pinvoke/pinvoke.aspx

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.

 

 

The second – in my opinion more interesting – tool is the P/Invoke Interop Assistant(here’s a more in-depth article, the 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.

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.