作者hl4 (Minimi)
看板Python
标题[问题] 关於Python呼叫dll
时间Wed Jun 2 11:05:15 2010
以下是dll的interface
SetBrowseCallback(CALLBACK pFunc, DWORD dwIdentifier, DWORD dwExtData);
BrowseServer()
pFunc是BrowseServer()所需要的callback function
pFunc的prototype大致如下
(LPTSTR sServerName, LPTSTR sServerIP, LPTSTR sServerVersion,
LPTSTR sServerType, LPTSTR sServerMAC, DWORD dwIdentifier, DWORD dwExtData)
我呼叫的方式如下:
dll = ctypes.CDLL("Server.dll")
sbc = dll.SetBrowseCallback
sbc.restype = None
callback_proto = ctypes.PYFUNCTYPE( None, ctypes.c_char_p, ctypes.c_char_p,
ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, DWORD, DWORD)
callback = callback_proto(py_callback)
#py_callback print所有参数
sbc(callback)
dll.BrowseServer()
虽然没有error但是我的callback function完全没被用到
想请问可能是哪部分的问题应该要怎麽解决,谢谢
--
Idle lawyers tend to become politicians,
so there is a certain social value in keeping lawyers busy.
from "Operating System Principles, 7th ed"
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.87.144.205
1F:→ sbrhsieh:callback_proto = ctypes.CFUNCTYPE(...) 06/02 11:40
2F:→ hl4:结果还是一样,但还是谢谢 06/02 13:12