的P / Invoke一个纯粹的C ++库? [英] P/Invoke a purely C++ library?

查看:116
本文介绍了的P / Invoke一个纯粹的C ++库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能的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).

这篇关于的P / Invoke一个纯粹的C ++库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆