Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 87fcd3a

Browse files
Update p02_write_simple_c_extension_module.rst
1 parent a9cd77b commit 87fcd3a

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

‎source/c15/p02_write_simple_c_extension_module.rst‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
有了这些,下面我们演示下编写扩展函数的一个简单例子:
3535

3636
::
37-
37+
/* pysample.c */
3838
#include "Python.h"
3939
#include "sample.h"
4040

@@ -103,20 +103,16 @@
103103
# setup.py
104104
from distutils.core import setup, Extension
105105
106-
setup(name='sample',
106+
setup(name="sample",
107107
ext_modules=[
108-
Extension('sample',
109-
['pysample.c'],
110-
include_dirs = ['/some/dir'],
111-
define_macros = [('FOO','1')],
112-
undef_macros = ['BAR'],
113-
library_dirs = ['/usr/local/lib'],
114-
libraries = ['sample']
108+
Extension("sample",
109+
["../sample.c", "pysample.c"],
110+
include_dirs = ['..'],
115111
)
116112
]
117113
)
118114
119-
为了构建最终的函数库,只需简单的使用 ``python3 buildlib.py build_ext --inplace`` 命令即可:
115+
为了构建最终的函数库,只需简单的使用 ``python3 setup.py build_ext --inplace`` 命令即可:
120116

121117
::
122118

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /