migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.19k stars 77 forks source link

Swift runtime DLL search path issue on Windows #160

Open tishin opened 1 year ago

tishin commented 1 year ago

After building the extension from tutorial on Windows and placing SimpleRunnerDriver.dll and SwiftGodot.dll into /bin I get the following error from Godot:

ERROR: Can't open dynamic library: C:/Projects/SimpleRunner-Base/bin/SimpleRunnerDriver.dll. Error: Error 126: The specified module could not be found..
   at: (platform/windows/os_windows.cpp:394)
ERROR: GDExtension dynamic library not found: C:/Projects/SimpleRunner-Base/bin/SimpleRunnerDriver.dll
   at: open_library (core/extension/gdextension.cpp:455)

The dll itself is obviously there. What appears to be missing is dll's dependencies: swiftCore.dll, swift_Concurrency.dll and so on. I managed to work around this issue by copying swift runtime directly into /bin. But there has to be a better way of doing this, right? Putting swift runtime in %PATH% environment variable doesn't seem to have any effect on the issue.

tishin commented 1 year ago

Godot runs LoadLibraryExA with LOAD_LIBRARY_SEARCH_DEFAULT_DIRS, which itself is a combination of

migueldeicaza commented 1 year ago

I suspect we will have a similar issue with Linux if Swift is not part of the system installation.

rrenna commented 4 months ago

Question from someone who doesn't quite understand how much of a blocker this is: If someone were to publish a game with a SwiftGodot extension - could the Swift runtime be copied to the appropriate folder during installation? Or is that folder off limits to be mutated on Windows by an installation wizard/Steam?

migueldeicaza commented 4 months ago

You can just copy it to the directory where your extension is (bin, see the comment from October 7

rrenna commented 4 months ago

Oh jeez I misunderstood - I thought the solution was the runtime needed to be in a bin subfolder in the installed computer after distribution to be runnable. Thanks for the clarification!