Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Provide additional information when LoadLibrary/dlopen fails #2086
A common problem when trying a new mod is that the mod's client dll has missing dependencies.
The cause of the problem should be logged to the debug log so this can be more easily resolved.
On Linux, the function
Note that the error should be logged before the
Also note that the client dll may be loaded in 2 different places, so both should log the error. The server dll load failure code already logs the error code (Windows) or the error message (Linux) so the same code can probably be reused.
Ah, this would be a huge help. From time to time I get this error reported with my mod and have never realised it could be a dependency issue.
Dependency Walker can do it, though it failed to resolve the SDL2 library because checking dependencies for a dll uses its directory as the working directory, instead of using the engine executables' directory.
It also isn't obvious when a dependency is missing unless you run the tool on the user's computer. I ended up using Process Monitor to see which dll load attempts failed. It turned out that the client dll was a debug build, and had the debug version of the VS 2017 runtime as a dependency, which isn't part of the redistributable.
The error given when a library fails to load for this reason is code
To find the error code i made a small tool that does exactly what i proposed here. Such a tool needs to be in the same directory as the engine executable to handle search order correctly so that it can find the SDL2 library. You can get it here: https://github.com/SamVanheer/NativeDllTester/releases
Uses Dot Net Framework and WPF, so make sure that's installed.