的P / Invoke一个纯粹的C ++库?Invoke

由网友(壮哉我Bigbang!)分享简介:是否有可能的P / Invoke一个纯C ++库,或者它必须被包裹在C中?Is it possible to P/Invoke a pure C++ library, or does it have to be wrapped in C?推荐答案C ++库可以P /调用,但是你需要使用依赖,找到错位的方法名(名字,...

是否有可能的P / Invoke一个纯C ++库,或者它必须被包裹在C中?

Is it possible to P/Invoke a pure C++ library, or does it have to be wrapped in C?

推荐答案

C ++库可以P /调用,但是你需要使用依赖,找到错位的方法名(名字,如@ 0!类名@类名@ ZZ)和实例方法使用ThisCall在p调用约定/调用,并通过实例的引用作为第一个参数(你可以存储在一个IntPtr构造函数的结果)。

C++ libraries can be P/invoked, but you'll need to use "depends" to find the mangled method names (names like "@0!classname@classname@zz") and for instance methods use "ThisCall" calling convention in the p/invoke and pass the reference of the instance as the first argument (you can store the result of the constructor within an IntPtr).

阅读全文

相关推荐

最新文章