调用C / C ++的蟒蛇? [英] Calling C/C++ from python?
问题描述
什么是构建一个python绑定到C或C ++库?
What would be the quickest way to construct a python binding to a C or C++ library?
(使用Windows如果此事项)
(using windows if this matters)
推荐答案
您应该看一看的 Boost.Python的,这里是从他们的网站采取短期introdution:
You should have a look at Boost.Python, here is the short introdution taken from their website:
升压Python库是用于连接Python和框架
C ++。它可以让你快速,无缝地揭露C ++类
函数和对象到Python,反之亦然,不使用特殊
工具 - 只要你的C ++编译器。它被设计来包装C ++接口
非侵入,所以你不应该有改变C ++ code。在
所有这些都是为了把它包起来,使得Boost.Python的理想曝光
第三方库到Python。图书馆的使用先进
元编程技术简化了其对用户的语法,从而使
包装code呈现一种声明界面的外观
定义语言(IDL)。
The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler. It is designed to wrap C++ interfaces non-intrusively, so that you should not have to change the C++ code at all in order to wrap it, making Boost.Python ideal for exposing 3rd-party libraries to Python. The library's use of advanced metaprogramming techniques simplifies its syntax for users, so that wrapping code takes on the look of a kind of declarative interface definition language (IDL).
这篇关于调用C / C ++的蟒蛇?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!