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这个函数导出
相关问答:
像 C 的 scanf() 那样
比如读入 1 2 3 a b c
每次读入一个
下面这个应该是你想要的吧:
Python code:
>>> k = raw_input()
0 0123 ds dsl sd
>>> k
'0 0123 ds dsl sd'
>>> ......
在list中添加一个类的局部变量 这样做是否合法 请看下面例子:
Python code:
class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......
我想用python解析网页中的url 在下载之前, 我想先发一个head请求 不需要下载整个网页, 先获得该网站的head信息, 读取一些信息之后 在调用这些库的read方法来读取整个网页 该怎么操作呢 多谢
帮顶了
有人能指教一 ......
C#里面用using System.Security.Cryptography; RSACryptoServiceProvider加密过的消息
用Python Crypto中RSA的方法 能直接 解吗?
RSA加密方式不是统一的吗?需要注意些什么?
有帮助。但是没解决问题。。。
......
RowNum=18
ColumnNum=10
SquareList=[[0 for a in range(ColumnNum)] for b in range(RowNum)]
ActiveList=[[0 for a in range(ColumnNum)] for b in range(RowNum)]
ActiveList[0][5]=1
SquareL ......