[waffle] [PATCH 28/33] examples/gl_basic: properly annotate the function pointers
Emil Velikov
emil.l.velikov at gmail.com
Mon Jul 7 10:28:35 PDT 2014
Windows uses a different calling convention than linux for their public API (__stdcall vs __cdelc).
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
examples/gl_basic.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/examples/gl_basic.c b/examples/gl_basic.c
index 6a399bd..0f4b5a3 100644
--- a/examples/gl_basic.c
+++ b/examples/gl_basic.c
@@ -193,12 +193,20 @@ enum {
#define WINDOW_WIDTH 320
#define WINDOW_HEIGHT 240
-static void (*glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-static void (*glClear)(GLbitfield mask);
-static void (*glGetIntegerv)(GLenum pname, GLint *params);
-static void (*glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLvoid* data);
-static void (*glViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
+#ifndef _WIN32
+#define APIENTRY
+#else
+#ifndef APIENTRY
+#define APIENTRY __stdcall
+#endif
+#endif
+
+static void (APIENTRY *glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+static void (APIENTRY *glClear)(GLbitfield mask);
+static void (APIENTRY *glGetIntegerv)(GLenum pname, GLint *params);
+static void (APIENTRY *glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid* data);
+static void (APIENTRY *glViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
/// @brief Command line options.
struct options {
--
2.0.0
More information about the waffle
mailing list