11// =====================================================================
22//
3- // PyStand.cpp -
3+ // PyStand.cpp -
44//
55// Created by skywind on 2022/02/03
66// Last Modified: 2023/03/17 20:06
@@ -82,7 +82,7 @@ std::wstring PyStand::Ansi2Unicode(const char *text)
8282
8383
8484// ---------------------------------------------------------------------
85- // init: _args, _argv, _cwd, _pystand, _home, _runtime,
85+ // init: _args, _argv, _cwd, _pystand, _home, _runtime,
8686// ---------------------------------------------------------------------
8787bool PyStand::CheckEnviron (const wchar_t *rtp)
8888{
@@ -192,11 +192,12 @@ bool PyStand::LoadPython()
192192
193193 // python dll must be load under "runtime"
194194 SetCurrentDirectoryW (runtime.c_str ());
195+ SetDllDirectoryW (runtime.c_str ());
195196 // LoadLibrary
196197 _hDLL = (HINSTANCE)LoadLibraryA (" python3.dll" );
197198 if (_hDLL) {
198199 _Py_Main = (t_Py_Main)GetProcAddress (_hDLL, " Py_Main" );
199- }
200+ }
200201
201202 // restore director
202203 SetCurrentDirectoryW (previous.c_str ());
@@ -317,7 +318,7 @@ int PyStand::DetectScript()
317318// ---------------------------------------------------------------------
318319// init script
319320// ---------------------------------------------------------------------
320- const char *init_script =
321+ const char *init_script =
321322" import sys\n "
322323" import os\n "
323324" import copy\n "
@@ -379,7 +380,7 @@ const char *init_script =
379380// ---------------------------------------------------------------------
380381
381382// ! flag: -static
382- // ! src:
383+ // ! src:
383384// ! link: stdc++, shlwapi, resource.o
384385// ! prebuild: windres resource.rc -o resource.o
385386// ! mode: win
@@ -388,7 +389,7 @@ const char *init_script =
388389#ifdef PYSTAND_CONSOLE
389390int main ()
390391#else
391- int WINAPI
392+ int WINAPI
392393WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR args, int show)
393394#endif
394395{
0 commit comments