Tool to find error codes for failed LoadLibrary calls Created 1 week ago2019-01-09 12:13:17 UTC by Solokiller Solokiller

Created 1 week ago2019-01-09 12:13:17 UTC by Solokiller Solokiller

Posted 1 week ago2019-01-09 12:13:17 UTC Post #341602
I made a small tool to find the error code returned by LoadLibrary calls. This is needed because the engine doesn't report the error code for failed client.dll library loading.

Repository here: https://github.com/SamVanheer/NativeDllTester
Download: https://github.com/SamVanheer/NativeDllTester/releases/tag/V1.0

See the README for usage.

The issue that made this tool necessary: https://github.com/ValveSoftware/halflife/issues/2086

I also included additional information for finding missing dependencies using other tools, since the error code won't tell you which dependencies are missing.
I used Process Monitor to find it by looking for library load attempts after the client dll is loaded, this is what the relevant information looks like:
User posted image
The missing library is a debug version of a VS2017 redistributable library that contains the C runtime. The redistributable only contains the release version, and the client.dll was a debug build. Recompiling it as a release build solved the problem. If you have VS2017 with C++ support installed it will have installed this debug version so you would be able to run it regardless.

This should make debugging could not load library <name> errors much easier.
Posted 1 week ago2019-01-10 05:00:23 UTC Post #341610
It's a shame that dependencies are so hard.

I guess statically linking to the Visual C++ runtime is okay solution for most use cases? I assume that's what this error is most of the time.
Posted 1 week ago2019-01-10 11:53:05 UTC Post #341613
It might, i'm not sure.
You must be logged in to post a response.