用c编写dll的LoadLibrary python++

2024-10-01 00:26:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我写了一个python脚本来加载用c++编写的dll。在

脚本是:

from ctypes import *
mydll = cdll.LoadLibrary('C:\\Users\\gpiscite\\Documents\\Project\\DllXPython\\Debug\\DllXPython.dll')
mydll
mydll.fnDllXPython(956, c_char_p("c_char_p"), c_void_p(0), "std::string")

c++代码在VisualStudio中编译为DLL,它是:

^{pr2}$

我在python进程上附加了调试,我看到thad在执行返回0时引发了异常。引发的异常是:

调试断言失败。。。。。_块类型“”有效(pHead->;nBlockUse)。。。。在

有什么想法吗?谢谢。在


Tags: fromdebugimportproject脚本ctypesusersdocuments