+2 votes

Hi there,

I have a project in Godot 3.0.6 that uses a GDNative C++ DLL. Once exported, the Godot .exe and GDNative .dll are in the same output folder and the game runs with no issues. (However I do get a WARNING: No Directory "Res://" in the console, but the game functions correctly).

Once I zip and copy the game over to any other PC (Win 7, 10) it says that it cannot load my GDNative DLL with the following message:


ERROR: Can't open dynamic link library: mygdnativetest.dll. Error: Error 126: The specified module could not be found.
platform/windows/os_windows.cpp:1700

ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
modules/gdnative/gdnative.cpp:317

ERROR: inilibrary: No nativescriptinit in "res://mygdnativetest.dll" found
modules/gdnative/nativescript/nativescript.cpp:1054

WARNING: No directory "res://"
WARNING: No directory "res://"


Can anyone please point me in the right direction as to what the problem could be? Is there perhaps a flag or something missing in the SConstruct file? It is very strange that the games runs locally but not when copied and run on another PC.

Thanks!

in Engine by (14 points)

Does the "any other PC" use NTFS for it's file system?

Sorry yes by "any other PC" they are NTFS file system, tried on both Windows 7 and 10.

NTFS is (iirc) casesensitive, where as FAT32 is not so if the original computer does not use NTFS it could well be the case the the filename is not in all lower case in the file system.

Hi guppy42, thanks for the suggestion. I can confirm that the DLL is the same lowercase from SConstruct GDNative dll build to the exported build.

I have tested this on the latest Godot Master Branch with NativeScript 1.1 and same isssue. Exported game runs fine on local pc but same error 126 on other PCs.

@upperclasslemon Did you find out what the problem was? I'm having the exact same problem and don't want to start a new thread.

also having the same problem. DenverCoder9, what happened to you?

Any update? I'm having the same problem. For me it works on Linux but not on Windows.

I'm having the same issue as well. It's been almost three years and not suggestions of a solution for this problem?

1 Answer

+1 vote

I think I know what the problem was, at least in my case.

My DLL relied on another DLL implicitly. It was the Microsoft Visual C++ runtime DLL, something like msvcr140.dll or what ever.

I had had that installed on my system, but some people I sent my game to did not.

The problem being that the error message Godot gives is a bit misleading. It's not that YOUR dll isn't found, it's that your dll failed to load because the other dll it required was not found. But the error handling just reports your dll as not found if it fails to load for any reason.

To solve this I did the following:
Remember that DLL resolution starts by looking in the current working directory for the executable trying to load the DLL, if it is not found there, then it looks in the system directory.

So since I didn't want to send an installer to my users which would put the dll in their system directory, I simply shipped the msvcr dll along side the exe so that it would be found at the first stage of resolution.

by (30 points)

I simply shipped the msvcr dll along side the exe so that it would be found at the first stage of resolution.

While this works, note that the MSVC redistributable EULA doesn't allow you to do this. Instead, you're supposed to bundle the installer and run it (possibly in an unattended manner using command line arguments).

It's kind of a mystery as to why the MSVC redistributable isn't being installed via Windows Update automatically, but that's how things are.

Ha, that I did not know. Thanks Microsoft, I hate it

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.