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嵌入)