Making my own OpenGL, what to do about wgl* entrypoints?
-
I'm building an opengl "spy" utility to capture opengl calls. I compiled my own DLL and called it opengl32.dll. The DLL exports entrypoints for most of the OpenGL calls as follows: typedef void (*glEnable_TYPE)(int cap); void glEnable(int cap) { glEnable_TYPE GL_glEnable; // returns a handle to the DLL, otherwise NULL hMod = LoadLibrary("C:/windows/system32/opengl32.DLL"); // returns the address of the DLL function, otherwise NULL GL_glEnable = (glEnable_TYPE) GetProcAddress(hMod, "glEnable"); GL_glEnable(cap); } The problem is, I cannot get the wgl entrypoints (wglMakeCurrent, etc.) to work. Either I include these in my opengl, in which case visual c++ reports: error C2491: 'wglMakeCurrent' : definition of dllimport function not allowed Or, if I do not include a definition of these functions, I get: error LNK2001: unresolved external symbol wglMakeCurrent Debug/opengl32.lib : fatal error LNK1120: 1 unresolved externals LINK : fatal error LNK1141: failure during build of exports file What can I do?