@@ -55,6 +55,8 @@ msgid ""
5555"each function that is going to be called by the Python interpreter. Global "
5656"or static C++ objects with constructors are probably not a good idea."
5757msgstr ""
58+ "是的,可以使用C ++中兼容C的功能。 在Python include文件周围放置` `extern“C”{...}`` "
59+ ",并在Python解释器调用的每个函数之前放置 ``extern“C”`` 。 具有构造函数的全局或静态C ++对象可能不是一个好主意。"
5860
5961#: ../../faq/extending.rst:37
6062msgid "Writing C is hard; are there any alternatives?"
@@ -64,7 +66,7 @@ msgstr "C很难写,有没有其他选择?"
6466msgid ""
6567"There are a number of alternatives to writing your own C extensions, "
6668"depending on what you're trying to do."
67- msgstr ""
69+ msgstr "编写自己的C扩展有很多选择,具体取决于您要做的事情。 "
6870
6971#: ../../faq/extending.rst:44
7072msgid ""
@@ -74,6 +76,9 @@ msgid ""
7476"corresponding C code. Cython and Pyrex make it possible to write an "
7577"extension without having to learn Python's C API."
7678msgstr ""
79+ "`Cython <http://cython.org>`_ 及其相关的 `Pyrex "
80+ "<https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/>`_ "
81+ "是接受稍微修改过的Python形式并生成相应C代码的编译器。 Cython和Pyrex可以编写扩展而无需学习Python的C API。"
7782
7883#: ../../faq/extending.rst:50
7984msgid ""
@@ -86,6 +91,11 @@ msgid ""
8691"<https://github.com/scipy/weave>`_ are also alternatives for wrapping C++ "
8792"libraries."
8893msgstr ""
94+ "如果需要连接到某些当前不存在Python扩展的C或C ++库,可以尝试使用 `SWIG <http://www.swig.org>`_ "
95+ "等工具包装库的数据类型和函数。 `SIP <https://riverbankcomputing.com/software/sip/intro>`__"
96+ " , `CXX <http://cxx.sourceforge.net/>`_ `Boost "
97+ "<http://www.boost.org/libs/python/doc/index.html>`_ , 或 `Weave "
98+ "<https://github.com/scipy/weave>`_ 也是包装C ++库的替代方案。"
8999
90100#: ../../faq/extending.rst:61
91101msgid "How can I execute arbitrary Python statements from C?"
@@ -138,6 +148,8 @@ msgid ""
138148" :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, "
139149"etc."
140150msgstr ""
151+ "要测试对象的类型,首先要确保它不是 *NULL* ,然后使用 :c:func:`PyBytes_Check` , "
152+ ":c:func:`PyTuple_Check` , :c:func:`PyList_Check` 等"
141153
142154#: ../../faq/extending.rst:95
143155msgid ""
@@ -155,7 +167,7 @@ msgstr "如何使用Py_BuildValue()创建任意长度的元组?"
155167
156168#: ../../faq/extending.rst:106
157169msgid "You can't. Use :c:func:`PyTuple_Pack` instead."
158- msgstr ""
170+ msgstr "不可以。应该使用 :c:func:`PyTuple_Pack` 。 "
159171
160172#: ../../faq/extending.rst:110
161173msgid "How do I call an object's method from C?"
@@ -361,7 +373,7 @@ msgstr ""
361373
362374#: ../../faq/extending.rst:430
363375msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?"
364- msgstr "如何找到未定义的g ++符号__builtin_new或__pure_virtual?"
376+ msgstr "如何找到未定义的g++符号__builtin_new或__pure_virtual?"
365377
366378#: ../../faq/extending.rst:432
367379msgid ""
@@ -370,6 +382,8 @@ msgid ""
370382"extension module using g++ (e.g., ``g++ -shared -o mymodule.so "
371383"mymodule.o``)."
372384msgstr ""
385+ "要动态加载g ++扩展模块,必须重新编译Python,要使用g ++重新链接(在Python Modules "
386+ "Makefile中更改LINKCC),及链接扩展模块(例如: ``g++ -shared -o mymodule.so mymodule.o`` )。"
373387
374388#: ../../faq/extending.rst:438
375389msgid ""
@@ -381,7 +395,7 @@ msgstr "能否创建一个对象类,其中部分方法在C中实现,而其
381395msgid ""
382396"Yes, you can inherit from built-in classes such as :class:`int`, "
383397":class:`list`, :class:`dict`, etc."
384- msgstr ""
398+ msgstr "是的,您可以继承内置类,例如 :class:`int` , :class:`list` , :class:`dict` 等。 "
385399
386400#: ../../faq/extending.rst:443
387401msgid ""
@@ -390,3 +404,5 @@ msgid ""
390404"this from C++ (i.e. you can inherit from an extension class written in C++ "
391405"using the BPL)."
392406msgstr ""
407+ "Boost Python库(BPL,http://www.boost.org/libs/python/doc/index.html)提供了一种从C "
408+ "++执行此操作的方法(即,您可以使用BPL继承自C ++编写的扩展类 )。"
0 commit comments