3 * Purpose: cdecl thunk wrapper library for Win32 stdcall OpenGL library
5 * Copyright (c) Jon TURNEY 2009,2013
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
26 // define USE_OPENGL32 makes gl.h declare gl*() function prototypes with stdcall linkage,
27 // so our generated wrappers will correctly link with the functions in opengl32.dll
30 #ifdef HAVE_XWIN_CONFIG_H
31 #include <xwin-config.h>
34 #include <X11/Xwindows.h>
36 #define GL_GLEXT_LEGACY
43 glWinResolveHelper(PROC
* cache
, const char *symbol
)
47 /* If not yet cached, call wglGetProcAddress */
48 if ((*cache
) == NULL
) {
49 proc
= wglGetProcAddress(symbol
);
51 (*cache
) = (PROC
) - 1;
57 /* Cached wglGetProcAddress failure */
58 else if ((*cache
) == (PROC
) - 1) {
61 /* Cached wglGetProcAddress result */
69 #define RESOLVE_RET(proctype, symbol, retval) \
70 static PROC cache = NULL; \
71 __stdcall proctype proc = (proctype)glWinResolveHelper(&cache, symbol); \
76 #define RESOLVE(proctype, symbol) RESOLVE_RET(proctype, symbol,)
78 #define RESOLVED_PROC(proctype) proc
81 Include generated cdecl wrappers for stdcall gl*() functions in opengl32.dll
83 OpenGL 1.2 and upward is treated as extensions, function address must
84 found using wglGetProcAddress(), but also stdcall so still need wrappers...
87 #include "generated_gl_thunks.c"