我试图访问Firefox浏览器附带的DLL( nss3.dll )中的一些function。 为了处理这个任务,我在Python中使用了ctypes。 问题是,它在加载到内存中的DLL的初始点失败。 这是我必须这样做的代码片段。 >>> from ctypes import * >>> windll.LoadLibrary("E:\\nss3.dll") 我得到的例外是 Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> windll.LoadLibrary("E:\\nss3.dll") File "C:\Python26\lib\ctypes\__init__.py", line 431, in LoadLibrary return self._dlltype(name) File "C:\Python26\lib\ctypes\__init__.py", line 353, in __init__ self._handle = _dlopen(self._name, mode) WindowsError: [Error 126] The specified module could not be found 我也尝试从Firefox安装path加载它假设可能有依赖关系。 […]
我刚刚开始使用ctypes,并希望使用C ++类,我已经使用ctypes在python内导出的dll文件。 所以可以说我的C ++代码看起来像这样: class MyClass { public: int test(); … 我会知道创build一个包含此类的.dll文件,然后使用ctypes在python中加载.dll文件。 现在我将如何创build一个MyClasstypes的对象并调用它的testing函数? 这甚至可能与ctypes? 或者我会考虑使用SWIG或Boost.Python,但ctypes似乎是小项目的最简单的select。