C ++ API的C ++版本? [英] C++ version of the C Python API?
问题描述
是否有用Python 2.5打包的C ++ API的C ++版本?
如果有一个OOP方法会很好在C ++中嵌入python。如果这个C ++ Python API清理了很多嵌入python所涉及的乱码代码,那么
也将是一个奖励。
谢谢。
Hi,
Is there a C++ version of the C Python API packaged with python 2.5?
It would be nice to have a OOP approach to embedding python in C++. It
would also be a bonus if this C++ Python API cleaned up a lot of the
messy code involved in embedding python.
Thanks.
推荐答案
2007年10月19日星期五17:37:29 -0500,Robert Dailey写道:
On Fri, 19 Oct 2007 17:37:29 -0500, Robert Dailey wrote:
是否有与Python 2.5一起打包的C ++ API的C ++版本?它有一个OOP方法在C ++中嵌入python会很好。如果这个C ++ Python API清理了很多嵌入python所涉及的乱码代码,那么
也将是一个奖励。
谢谢。
Hi,
Is there a C++ version of the C Python API packaged with python 2.5? It
would be nice to have a OOP approach to embedding python in C++. It
would also be a bonus if this C++ Python API cleaned up a lot of the
messy code involved in embedding python.
Thanks.
也许,关于`C ++扩展`_或'嵌入C ++`_在
`扩展和嵌入`_文档中的说法(在doc.python.org上描述为
C / C ++程序员教程)可以提供帮助。
根据你的嵌入程度,那些随机注释在扩展文档上传播了
,有点耐心和ctrl + f,可能
帮助:
*在C ++中,运算符new和delete主要用于
相同的含义,我们将以下讨论限制在C情况下。
- `1.10引用计数< http://docs.python.org/ext/refcounts.html>`_
*"注意PyMODINIT_FUNC将函数声明为void返回类型,
声明平台所需的任何特殊链接声明,并且对于C ++,
将该函数声明为externC。 - `1.4模块的方法
表和初始化函数< http://docs.python.org/ext/
methodTable.html>`_
干杯,>
Stargaming
... _C ++扩展: http://docs.python.org/ext/cplusplus.html
... _Embedding in C ++: http://docs.python.org/ext/embeddingInCplusplus.html
。 .. _Extending and embedding: http://docs.python.org/ext/ ext.html
Perhaps, the remark about `C++ extensions`_ or `Embedding in C++`_ in the
`Extending and Embedding`_ docs (described on doc.python.org as a
"tutorial for C/C++ programmers") can help.
Depending on your level of embedding, those random annotations spread
over the extending docs, found with a little patience and ctrl+f, might
help:
* "In C++, the operators new and delete are used with essentially the
same meaning and we''ll restrict the following discussion to the C case."
-- `1.10 Reference counts <http://docs.python.org/ext/refcounts.html>`_
* "Note that PyMODINIT_FUNC declares the function as void return type,
declares any special linkage declarations required by the platform, and
for C++ declares the function as extern "C"." -- `1.4 The Module''s Method
Table and Initialization Function <http://docs.python.org/ext/
methodTable.html>`_
Cheers,
Stargaming
... _C++ extensions: http://docs.python.org/ext/cplusplus.html
... _Embedding in C++: http://docs.python.org/ext/embeddingInCplusplus.html
... _Extending and embedding: http://docs.python.org/ext/ext.html
是否有用Python 2.5打包的C ++ API的C ++版本?
Stargaming已经提到了优点;第一个答案是:
是的,API打包的python 2.5可以和C ++一起使用。它是相同API的C ++
版本,因为它添加了适当的externC。
所有原型的声明,它是专门清理的(十年前)
与C ++一起工作。
这个API没有使用许多C ++功能,包括
类,模板或重载。
问候,
Martin
Is there a C++ version of the C Python API packaged with python 2.5?
Stargaming has already mentioned the fine points; the first answer is:
yes, the API packaged python 2.5 can be used with C++. It is a C++
version of the same API as it adds proper extern "C" declarations around
all prototypes, and it was specifically cleaned up (ten years ago)
to work with C++.
This API does not make use of many of the C++ features, including
classes, templates, or overloading.
Regards,
Martin
是否有用Python 2.5打包的C ++ API的C ++版本?
Stargaming已经提到了精点;第一个答案是:
是的,API打包的python 2.5可以和C ++一起使用。它是相同API的C ++
版本,因为它添加了适当的externC。
所有原型的声明,它是专门清理的(十年前)
与C ++一起工作。
这个API没有使用许多C ++功能,包括
类,模板或重载。
问候,
马丁
Is there a C++ version of the C Python API packaged with python 2.5?
Stargaming has already mentioned the fine points; the first answer is:
yes, the API packaged python 2.5 can be used with C++. It is a C++
version of the same API as it adds proper extern "C" declarations around
all prototypes, and it was specifically cleaned up (ten years ago)
to work with C++.
This API does not make use of many of the C++ features, including
classes, templates, or overloading.
Regards,
Martin
这篇关于C ++ API的C ++版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!