vc6编写python扩展的方法分享

yipeiwu_com6年前Python基础

系统环境:VC6 + Python-2.5.4

1、下载Python-2.5.4源码。

2、解压,打开D:\Python-2.5.4\PC\VC6\pcbuild.dsw,编译,D:\Python-2.5.4\PC\VC6\下得到python25.dll、python25_d.dll、python25.lib、python25_d.lib。

3、使用VC6建立一个动态链接库工程,拷贝D:\Python-2.5.4\PC\example_nt\example.c到工程目录下,并添加到工程中。

4、设置工程。

复制代码 代码如下:

打开tools->options->directories,添加D:\PYTHON-2.5.4\INCLUDE 到 includes files中,添加D:\PYTHON-2.5.4\PC\VC6 到 Library files中。
打开Progect->Settings,将Win32 Debug->Link->Output file name修改为example_d.pyd,将Win32 Release->Link->Output file name修改为example.pyd

5、编译。

6、尝试调用:

复制代码 代码如下:

D:\MY Project\testpymodule\Release>python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
>>> example.foo()
Hello, world
>>>

相关文章

python斐波那契数列的计算方法

题目: 计算斐波那契数列。具体什么是斐波那契数列,那就是0,1,1,2,3,5,8,13,21,34,55,89,144,233。 要求: 时间复杂度尽可能少 分析: 给出了...

浅谈Python 敏感词过滤的实现

一个简单的实现 class NaiveFilter(): '''Filter Messages from keywords very simple filter imp...

python笔记(2)

继续List: 删除元素: 复制代码 代码如下: a =[1, 2, 3, 4] a[2:3] = [] #[1, 2, 4] del a[2] #[1, 2] 清空list 复制代码...

python 利用pywifi模块实现连接网络破解wifi密码实时监控网络

python 利用pywifi模块实现连接网络破解wifi密码实时监控网络,具体内容如下: import pywifi from pywifi import * import tim...

python中找出numpy array数组的最值及其索引方法

在list列表中,max(list)可以得到list的最大值,list.index(max(list))可以得到最大值对应的索引 但在numpy中的array没有index方法,取而代之...