易截截图软件、单文件、免安装、纯绿色、仅160KB

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这个函数导出



相关问答:

[提问]Python 如何忽略 whitespace 读入

像 C 的 scanf() 那样
比如读入 1 2 3 a b c
每次读入一个
下面这个应该是你想要的吧:
Python code:

>>> k = raw_input()
0 0123 ds dsl sd
>>> k
'0 0123 ds dsl sd'
>>> ......

python怎么print 'hello world'

大家好,我是一个新手,刚开始学python,但是刚开始的helloworld都没法打印,让我很无奈。
我的python安装路径为f:\python31。在path中也设置对了,在windows下运行是这样显示的,希望各位前辈指点一下。谢谢
Pyth ......

python list中添加类对象的问题

在list中添加一个类的局部变量 这样做是否合法 请看下面例子:
Python code:

class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......

C# RSA Python - .NET技术 / C#

C#里面用using System.Security.Cryptography; RSACryptoServiceProvider加密过的消息
用Python Crypto中RSA的方法 能直接 解吗?
RSA加密方式不是统一的吗?需要注意些什么?

有帮助。但是没解决问题。。。
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号