Game Dev

How to debug module-loading errors in Unreal Engine

In Unreal Engine, when you get an error of this kind during the loading phase:

“The game module ‘<somemodule.dll>’ could not be loaded. There may be an operating system error or the module may not be properly set up.”

usually there is some missing dll dependency in somemodule.dll, probably you’ve just disabled a plugin which was referenced by some game module.

The problem is that the error you get is generic and doesn’t tell you which dependency is missing. But don’t worry, this is easy to debug; you just need to activate a diagnostic flag on your windows development environment using GFlags (Global Flags Editor), a tool included in the Windows SDK (make sure you have installed a Windows SDK). You can use this application to set a debugging flag called “Show loader snaps” which is useful to get extra debug messages during DLLs loading.

If you are using Windows SDK 8.1, you can just launch Global Flags (x64) Desktop Application from the Windows launcher (Windows button + S, then type gflags). Here is the GFlags GUI where you need to check the Show loader snaps flag.

Global Flags Editor GUI – Check the Show loader snaps under the System registry tab

After checking this flag, you have to reboot. With this flag enabled, you will get a lot of extra debug log messages inside the Visual Studio Output window while debugging your project. Here you will see all the library dependencies when loading a DLL and you will get an error for the missing library.

When you have finished, you should disable the Show loader snaps flag and restart Windows again.

Using GFlags from command line

At the time of writing, the GFlags tool provided with the Windows SDK 10 does not show the GUI, so you have to set the flag from command line.

First open an admin command prompt hitting Windows + X and then selecting Command Prompt (Admin). Then type these commands:

The gflags /r [{+ | -}Flag [{+ | -}Flag...]][a] sets or clears a flag in the registry. sls is the shortname for the Show loader snaps flag.

After reboot, you will see the extra log output for the DLLs loading.

When you have finished, use this command to disable the sls flag and reboot:

 

Notes

  1. GFlags Commands []

Leave a Reply

Your email address will not be published. Required fields are marked *