c# - 从 native dll 生成 C# DLLImport 声明

标签 c# dll native dllimport

您是否知道一种软件可以从 native DLL 自动生成 C# 代码(在 .cs 中具有 [DllImport] 属性)以便在 C# 代码中使用此 DLL?

最佳答案

检查 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.

关于c# - 从 native dll 生成 C# DLLImport 声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3771648/

相关文章:

c# - .NET - 如何确定字符串(分隔符)上的组数据

c# - 点靠近对角线

python - 如何以编程方式在 C++ 或 Python 中列出 DLL 的依赖项?

c++ - 无法在 dll 中找到方法的入口点?

代码执行无法继续,因为找不到 libquickmail-0.dll?

windows - Windows 上 readlink 的 native 替代方案

java - 来自原生的 Android O 设备序列号

android - ExceptionInInitializerError Android NDK 由 : UnsatisfiedLinkError: findLibrary returned null 引起

c# - 远程运行 powershell 命令时出错

c# - MongoDb 自定义集合序列化器