Skip to content

fix: failed to load python when startup as subprocess.#80

Merged
skywind3000 merged 1 commit into
skywind3000:masterfrom
thegoodtgg:startup_as_subprocess
Jun 19, 2024
Merged

fix: failed to load python when startup as subprocess.#80
skywind3000 merged 1 commit into
skywind3000:masterfrom
thegoodtgg:startup_as_subprocess

Conversation

@thegoodtgg

Copy link
Copy Markdown
Contributor

According the doc about "LoadLibrary" and "SetDllDirectory", when PyStand not run as sub-process, dll search path not including "runtime" directory, PyStand failed to load python3.dll.
Using SetDllDirectory instead of "SetCurrentDirectory" would fix the problem.

@thegoodtgg

Copy link
Copy Markdown
Contributor Author

Although, I haven't found any apparent evidences from ms doc. I guess it's related to the way call "CreateProcess" to create PyStand process.

I only found this from LoadLibrary - Remarks

The first directory searched is the directory containing the image file used to create the calling process (for more information, see the CreateProcess function). Doing this allows private dynamic-link library (DLL) files associated with a process to be found without adding the process's installed directory to the PATH environment variable.

However in our situation, python3.dll is loaded from working directory not the application directory.

@skywind3000

skywind3000 commented Jun 14, 2024

Copy link
Copy Markdown
Owner

thanks, but PyStand is using tabs for indentation, while you are using spaces, please keep consistency.

@skywind3000 skywind3000 merged commit d743904 into skywind3000:master Jun 19, 2024
H1DDENADM1N added a commit to H1DDENADM1N/PyStand that referenced this pull request Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants