diff --git a/C和C++扩展/pydext/pydext/build.bat b/C和C++扩展/pydext/pydext/build.bat new file mode 100644 index 0000000..0a08efd --- /dev/null +++ b/C和C++扩展/pydext/pydext/build.bat @@ -0,0 +1,5 @@ +cd %~dp0 + +python setup.py build + +pause \ No newline at end of file diff --git a/C和C++扩展/pydext/pydext/build/lib.win32-3.5/pydext.cp35-win32.pyd b/C和C++扩展/pydext/pydext/build/lib.win32-3.5/pydext.cp35-win32.pyd new file mode 100644 index 0000000..08d61cb Binary files /dev/null and b/C和C++扩展/pydext/pydext/build/lib.win32-3.5/pydext.cp35-win32.pyd differ diff --git a/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.cp35-win32.exp b/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.cp35-win32.exp new file mode 100644 index 0000000..1e2436f Binary files /dev/null and b/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.cp35-win32.exp differ diff --git a/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.cp35-win32.lib b/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.cp35-win32.lib new file mode 100644 index 0000000..a8e6104 Binary files /dev/null and b/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.cp35-win32.lib differ diff --git a/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.obj b/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.obj new file mode 100644 index 0000000..1ec8e2b Binary files /dev/null and b/C和C++扩展/pydext/pydext/build/temp.win32-3.5/Release/pydext.obj differ diff --git a/C和C++扩展/pydext/pydext/setup.py b/C和C++扩展/pydext/pydext/setup.py new file mode 100644 index 0000000..03ce03e --- /dev/null +++ b/C和C++扩展/pydext/pydext/setup.py @@ -0,0 +1,8 @@ +from distutils.core import setup, Extension + +module = Extension('pydext', sources = ['pydext.c']) + +setup (name = 'pydext', + version = '1.0.0', + description = 'This is pydext', + ext_modules = [module]) \ No newline at end of file diff --git a/C和C++扩展/pydext/pydext/test.py b/C和C++扩展/pydext/pydext/test.py new file mode 100644 index 0000000..3a3d870 --- /dev/null +++ b/C和C++扩展/pydext/pydext/test.py @@ -0,0 +1,22 @@ +import sys + +sys.path.insert(0, + './build/lib.{0}-{1}.{2}'.format(sys.platform, sys.version_info.major, sys.version_info.minor)) + + +import pydext + +print(pydext) +print(dir(pydext)) + +print(pydext.__author__) +print(pydext.__mail__) + +print(pydext.hello()) + +print(pydext.hello2('Irony')) + +print(pydext.sum(1, 5)) + +# 结果变负数 +print(pydext.sum(1, 5, minus=True)) diff --git a/C和C++扩展/pydext/pydext/说明.txt b/C和C++扩展/pydext/pydext/说明.txt new file mode 100644 index 0000000..5c7ef54 --- /dev/null +++ b/C和C++扩展/pydext/pydext/说明.txt @@ -0,0 +1 @@ +该目录下的setup.py是在vs编译环境的cmd下调用build.bat进行编译生成build文件夹。然后执行python test.py 对build文件夹中的pyd进行测试 \ No newline at end of file diff --git a/C和C++扩展/pydext/说明.txt b/C和C++扩展/pydext/说明.txt new file mode 100644 index 0000000..7eca247 --- /dev/null +++ b/C和C++扩展/pydext/说明.txt @@ -0,0 +1 @@ +该目录的test.py是用vs打开pydext.sln编译后生成的Release文件夹里的pyd进行测试 \ No newline at end of file