glad2 loader is closing library immediately
The generated glad2 C code automatically unloads the opengl library after loading all the function pointers.

Consider keeping the library loaded until the application is done and explicitly calls gladLoaderUnloadGL().


I used these options in the generator (multicontext + loader):

* Loader generated by glad 2.0.0-beta on Mon Jul  8 09:32:32 2019
 *
 * Generator: C/C++
 * Specification: gl
 * Extensions: 603
 *
 * APIs:
 *  - gl:compatibility=4.6
 *
 * Options:
 *  - MX_GLOBAL = False
 *  - ON_DEMAND = False
 *  - LOADER = True
 *  - ALIAS = False
 *  - HEADER_ONLY = False
 *  - DEBUG = False
 *  - MX = True