Last active
July 10, 2020 07:41
-
-
Save diaphore/30ecc94ede1814c7dbdcb0d35d119212 to your computer and use it in GitHub Desktop.
Unify native entry points and dynamic imports by faking `__imp_*` symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "glimp.h" | |
| #if defined _WIN32 | |
| #include <Windows.h> | |
| #pragma clang diagnostic push | |
| #pragma clang diagnostic ignored "-Wmissing-variable-declarations" | |
| #define COMMAND(name) __declspec(dllexport) PROC __imp_##name; | |
| #include "glimp.inl" | |
| #pragma clang diagnostic pop | |
| void | |
| glimp_initialize(void) | |
| { | |
| #define COMMAND(name) __imp_##name = wglGetProcAddress(#name); | |
| #include "glimp.inl" | |
| } | |
| #endif // defined _WIN32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma once | |
| #if defined _WIN32 | |
| #define GLAPI __declspec(dllimport) | |
| // Prevent the inclusion of <Windows.h> | |
| #if !defined APIENTRY | |
| #define WINAPI __stdcall | |
| #define APIENTRY WINAPI | |
| #endif | |
| #endif // defined _WIN32 | |
| #define GL_GLEXT_PROTOTYPES | |
| #include <GL/glcorearb.h> | |
| void glimp_initialize(void); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| COMMAND(glCreateBuffers) | |
| COMMAND(glDebugMessageCallback) | |
| COMMAND(glDebugMessageControl) | |
| #undef COMMAND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment