(C++) Diagnosing DLL issues with SDL2 and MinGW

I’m trying to get a simple SDL2 application I wrote up and running but there seems to be a problem with SDL2 on my computer. I am running 64-bit Windows 8.1 Pro with all MS Visual Studio C++ 2013 libraries installed (x64 and x86) and Windows fully updated. SDL2 worked fine on my old computer with a similar setup (I recently re-installed Windows) so I am at a loss to explain this error.

TL;DR: Simple test code I have written fails cryptically when loading a DLL from C:WindowsSystem32. How can I diagnose DLL loading issues on Windows?

Test Code

#include "SDL.h"

int main(int argc, char* argv[])

    return 0;


CXX = mingw32-g++
LIBRARY_FLAGS=-lmingw32 -lSDL2main -lSDL2 -mwindows

main.exe: main.cpp
    $(CC) $(LIBRARY_PATHS) $(LIBRARY_INC) -o main.exe main.cpp $(LIBRARY_FLAGS)

    rm main.exe

Compiling and Running

$ mingw32-make
cc -LC:MinGWSDL2-2.0.3i686-w64-mingw32lib -IC:MinGWSDL2-2.0.3i686-w64-mingw32includeSDL2 -o main.exe main.cpp -lmingw32 -lSDL2main -lSDL2
? gdb .main.exe
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
Reading symbols from D:Projectssdl-testmain.exe...done.
(gdb) run
Starting program: D:Projectssdl-test/.main.exe
[New Thread 3136.0xae4]
warning: SHIMVIEW: ShimInfo(Complete)

gdb: unknown target exception 0xc000007b at 0x7758d4f2
During startup program exited with code 0xc000007b.
(gdb) quit

After much Googling I figured out that the error code given (0xc000007b) is related to loading DLLs, so I checked the Event Viewer:

Event Logs

Event Viewer:
Faulting application name: main.exe, version:, time stamp: 0x02d2e568
Faulting module name: ntdll.dll, version: 6.3.9600.17736, time stamp: 0x550f42c2
Exception code: 0xc000007b
Fault offset: 0x0009d4f2
Faulting process id: 0xc40
Faulting application start time: 0x01d0a1729dcec24e
Faulting application path: D:Projectssdl-testmain.exe
Faulting module path: C:WindowsSYSTEM32ntdll.dll
Report Id: db8737d8-0d65-11e5-8268-c4d987e72ee3
Faulting package full name: 
Faulting package-relative application ID: 

From another log:

Windows cannot access the file  for one of the following reasons: there is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer; or the disk is missing. Windows closed the program main.exe because of this error.

Program: main.exe

The error value is listed in the Additional Data section.
User Action
1. Open the file again. This situation might be a temporary problem that corrects itself when the program runs again.
2. If the file still cannot be accessed and
    - It is on the network, your network administrator should verify that there is not a problem with the network and that the server can be contacted.
    - It is on a removable disk, for example, a floppy disk or CD-ROM, verify that the disk is fully inserted into the computer.
3. Check and repair the file system by running CHKDSK. To run CHKDSK, click Start, click Run, type CMD, and then click OK. At the command prompt, type CHKDSK /F, and then press ENTER.
4. If the problem persists, restore the file from a backup copy.
5. Determine whether other files on the same disk can be opened. If not, the disk might be damaged. If it is a hard disk, contact your administrator or computer hardware vendor for further assistance.

Additional Data
Error value: 00000000
Disk type: 0

ntdll.dll is where I’ve lost the trail; I cannot figure out why my program crashes when loading this DLL. Programs such as ProcMon and DependencyWalker have failed to tell me anything, and I can’t seem to find any official Microsoft documentation on what ntdll.dll does or how to fix it.

Thanks in advance for any advice.

Source: dll

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.