python加载dll函数失败_Python:使用ctypes访问DLL函数 – 按函数* name *访问失败
my
PythonClient(下面)想調(diào)用一個ringBell函數(shù)(使用ctypes從DLL加載).但是,嘗試通過其名稱訪問ringBell會導(dǎo)致AttributeError.為什么?
RingBell.h包含
namespace MyNamespace
{
class MyClass
{
public:
static __declspec(dllexport) int ringBell ( void ) ;
} ;
}
RingBell.cpp包含
#include
#include "RingBell.h"
namespace MyNamespace
{
int __cdecl MyClass::ringBell ( void )
{
std::cout << "\a" ;
return 0 ;
}
}
myPythonClient.py包含
from ctypes import *
cdll.RingBell[1]() # this invocation works fine
cdll.RingBell.ringBell() # however, this invocation errors out
# AttributeError: function 'ringBell' not found
總結(jié)
以上是生活随笔為你收集整理的python加载dll函数失败_Python:使用ctypes访问DLL函数 – 按函数* name *访问失败的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 命令行 笔记本键盘禁用_宏碁发布Endu
- 下一篇: 多个ip对应的是同一个mac_Pytho