stw_cleanup() attempts to destroy stw_dev->screen before verifying it's non null.
stw_cleanup() in_ src\gallium\frontends\wgl\stw_device.c:222_ crashes if the stw_dev->screen is NULL in the call to:
stw_dev->screen->destroy(stw_dev->screen);
This should probably be checked for and the destroy call skipped if it is NULL.
The code I'm working (which based on an old version of UE4) does a quick: LoadLibrary(), checks entry points in dll, then calls CloseLibrary(), before actually creating an OpenGL device for real. Although slightly inefficient, it allows to verify the DLL is valid before going into the complex drawing code.
However, CloseLibrary() calls DllMain( ... DLL_PROCESS_DETACH ...), which in turn call stw_cleanup(), which crashes due to the null ->screen pointer mentioned above.