Generate C# DLLImport declarations from a native dll

五迷三道 提交于 2019-12-18 14:12:52

问题


Do you know a soft which automatically generates C# code (with [DllImport] attributes in .cs) from a native DLL in order to use this DLL in a C# code?


回答1:


Checkout the P/Invoke Interop Assistant:

In marshalling, there are a bunch of attributes and rules. Understanding all those attributes and rules seem a bit daunting. In order to make developing work more efficient and easier on those attributes and the rules, P/Invoke Interop Assistant comes out. It is a toolkit that helps developers to efficiently convert from C to managed P/Invoke signatures or verse visa. This is conceptually similar to TlbImp for COM Interop which generates managed proxy entry points based on some formal description of the unmanaged side but it works for P/Invoke. The toolkit was first released on MSDN Magazine website in Jan, 2008.website in Jan, 2008.



来源:https://stackoverflow.com/questions/3771648/generate-c-sharp-dllimport-declarations-from-a-native-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!