从Python调用C ++ DLL [英] Calling C++ DLLs from Python

查看:114
本文介绍了从Python调用C ++ DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用ctypes从Python访问C ++ DLL并从中运行函数(或类方法)。如果没有,还有另一种方法吗?

I'd like to know if it is possible to use ctypes to access C++ DLLs from Python and run functions (or class methods) from them.If not, is there another way to do this?

推荐答案

此问题已得到回答很多次这是一个完全相同的副本!

总之,您还不能使用Ctypes做到这一点,但是您可以使用许多其他代码生成器来完成这项工作。 SWIG Boost.Python 是最受欢迎的两个。

In summary, no you can't do it with Ctypes (yet) but there are a number of other code generators you could use to do the job. SWIG and Boost.Python are two of the most popular.

这篇关于从Python调用C ++ DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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