-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect usage of AddDllDirectory
#95905
Comments
AddDllDirectory
AddDllDirectory
AddDllDirectory
Thanks! Unfortunately, I'm not able to reproduce this. I tested with Godot v4.3 using the godot-jolt extension and its sample project. When I export, the DLL gets placed in the same folder as the EXE, which loads just fine. Then I tried moving the EXE so that it was in the same path as it was in the project, so I put it under The only way I could prevent it from being loaded was to put it under some random directory, that wasn't the same as the directory that's specified in the I also re-ran these tests with Godot v4.2.2, and it behaved exactly the same. If the DLL was either next to the EXE, or in the path specified in the Can you give some more details about how to reproduce? Am I missing a step? |
Your folder structure is incorrect. But I see now that the diagram I added maybe wasn't that clear about it:
results in
results in
Placing the .dll in the same folder as the .exe does indeed work. The call to |
Ah, ok, thanks! Using that directory structure, I am able to reproduce the issue, and I can confirm that passing an absolute path to Here's PR #96192 which makes that change |
Tested versions
4.3
System information
Windows 11
Issue description
Loading GDExtension dll files on Windows does not work if the project has been exported as a .pck file and the .exe is launched from a different folder. This is because
AddDllDirectory
is called with a relative path and fails. According to the documentationAddDllDirectory
needs to be called with an absolute path.It works if the addons folder is next to the .exe because then
LoadLibraryExW
gets the correct relative path.Steps to reproduce
Add GDExtension addon to project
export as .pck
copy the addon folder next to the .pck
place the .exe in a different folder
run the .exe from the folder containing the .pck
Minimal reproduction project (MRP)
|- test.pck
|- addons/
|- bin/
|--test.exe
The text was updated successfully, but these errors were encountered: