Python 3.2 PyRun_SimpleString-它在哪里

Python 3.2 PyRun_SimpleString - Where is it?

本文关键字:SimpleString- 在哪里 PyRun Python      更新时间:2023-10-16

我正在尝试将一个应用程序与定制的Python发行版一起发布(添加了模块和我自己的扩展)。

为了保持简单,不冒与潜在现有设施发生冲突的风险,我认为最好的方法是运送。\DLL*.*和。\在一个子目录下用我的应用程序从\Python32\中解放*.*树。\MyApp\Python\

我只直接调用3个Py*函数:(代码是C++Builder…)

typedef void (__stdcall *PY_SETPYTHONHOME) (wchar_t *);
PY_SETPYTHONHOME Py_SetPythonHome;
typedef void (__stdcall *PY_INITIALIZE) ();
PY_INITIALIZE Py_Initialize;
typedef int (__stdcall *PYRUN_SIMPLESTRING) (const char *);
PYRUN_SIMPLESTRING PyRun_SimpleString;


HMODULE py_dll_hndle;
py_dll_hndle = ::LoadLibrary((ExtractFilePath(Application->ExeName) + "Python\DLLS\python3.dll").c_str());
ShowMessage(py_dll_hndle == NULL ? L"Bah" : L"Yay");     // Result: "Yay"

Py_SetPythonHome = (PY_SETPYTHONHOME) ::GetProcAddress(py_dll_hndle, "Py_SetPythonHome");
ShowMessage(Py_SetPythonHome == NULL ? L"Bah" : L"Yay");     // Result: "Yay"

Py_Initialize = (PY_INITIALIZE) ::GetProcAddress(py_dll_hndle, "Py_Initialize");
ShowMessage(Py_Initialize == NULL ? L"Bah" : L"Yay");     // Result: "Yay"

PyRun_SimpleString = (PYRUN_SIMPLESTRING) ::GetProcAddress(py_dll_hndle, "PyRun_SimpleString");
ShowMessage(GetLastError());     // Result: "127" (ERROR_PROC_NOT_FOUND)
ShowMessage(PyRun_SimpleString == NULL ? L"Bah" : L"Yay");     // Result: "Bah"

PyRun_SimpleString不存在?我一直在寻找使用http://www.nirsoft.net/DLL导出查看器。。。它不在那里。我很困惑。。。它在哪里?

有两个DLL的python3.DLL和python32.DLL。第一个是第二个的子集。只有一个python32.dll的副本隐藏在我的\Windows\SysWOW64\目录中,而python3.dll也在c:\python32\dll目录中。

使用python32.dll而不是python3.dll解决了问题。

为什么会有部分重复仍然是个谜。。。