用Python检查DLL
我现在正在用Python对一个DLL进行一些自我检查。我想根据这个DLL自动创建一个图形测试界面。
我可以很容易地在Python中加载我的DLL,并调用一些函数。主要的问题是,如果我在没有调用任何方法的情况下对这个对象使用“dir”命令,我得到的结果是
>>> dir(myLib)
['_FuncPtr', '__class__', '__delattr__', '__dict__', '__doc__',
'__format__', '__getattr__', '__getattribute__', '__getitem__', '__hash__', '__i
nit__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__s
etattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_func_fl
ags_', '_func_restype_', '_handle', '_name']
而当我手动调用一个函数(比如“Read_Version”)时,我用“dir”命令得到的结果是
>>> dir(myLib)
['Read_Version', '_FuncPtr', '__class__', '__delattr__', '__dict__', '__doc__',
'__format__', '__getattr__', '__getattribute__', '__getitem__', '__hash__', '__i
nit__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__s
etattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_func_fl
ags_', '_func_restype_', '_handle', '_name']
看起来自我检查只对我已经调用过的函数有效,这样就不是特别“有用”了;)
你有没有其他的想法,可以获取DLL中的函数?(当然是在Python中)
我在Windows上使用的是Python 2.6。