1
我有这样的代码:Python的 - 从python33.dll调用函数(访问冲突)
import ctypes
lib = ctypes.WinDLL('python33.dll')
print(lib['PyRun_SimpleString'])
func = lib['PyRun_SimpleString']
func.argtypes = [ctypes.c_char_p]
func.restype = ctypes.c_int
arg = "print(':P')"
arg = arg.encode('utf-8')
func(arg)
结果:
OSError: exception: access violation reading 0x00000004
运行使用文本崇高(python3.3嵌入)