python win下调用dll
小弟接触python 2个星期了,安装的是python3.1版。
我用的是windows7,想写个调用dll的程序实践。问题来了:
C++代码:
extern "C" int __stdcall test();
int __stdcall test()
{
return 1;
}
这个函数是写在.h文件里面的,用vs2005编译成dll。
python代码:
>>> import ctypes
>>> dll = ctypes.WinDLL('C:\\Python31\\libs\\INetWork.dll')
>>> down = dll.test
Traceback (most recent call last):
File " <pyshell#5>", line 1, in <module>
down = dll.test
File "C:\Python31\lib\ctypes\__init__.py", line 363, in __getattr__
func = self.__getitem__(name)
File "C:\Python31\lib\ctypes\__init__.py", line 368, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'test' not found
上网查了下资料有说要吧.dll 改成.pyd ?
我试了下 不管是 改成py 还是pyd都不行 提示的错误都一样。
求大神解惑,不胜感激
谢谢楼上 我用depends看了 还真没有test这个函数导出
相关问答:
请问下,我的是python2.5安装了PIL模块,然后编写程序打开本机上的一个图片时,为什么老出现错误呢,老是找不到图片,错误提示如下:File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1888, in o ......
在文本文件中匹配项包含中文
如内容为:gamename=中文
key=天下
文本文件的编码的文件为utf-8
python代码如下:
# -*- coding:UTF-8 -*-
contents=open(from_pa ......
C#里面用using System.Security.Cryptography; RSACryptoServiceProvider加密过的消息
用Python Crypto中RSA的方法 能直接 解吗?
RSA加密方式不是统一的吗?需要注意些什么?
有帮助。但是没解决问题。。。
......
异常代码如下:
write a file error: [Errno 2] No such file or directory: 'C:\x0cile.txt'
Traceback (most recent call last):
File "C:\Documents and Settings\USER\桌面\复 ......
RT。
我想要下载一个网站上的图片,但是该网站的图片地址是通过浏览器执行网页的JavaScript脚本后才返回的,使用urllib2的urlopen只能得到带有JavaScript代码的网页源代码。
想要用wx模块的wx.lib.iew ......