summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-17 10:51:38 -0800
committerEric Anholt <eric@anholt.net>2013-12-17 12:10:34 -0800
commit8022cda75d65f537c48d4b43b44879abe558c1b7 (patch)
tree0260b4875584fcb9a7033d71948bc71a436cf67c
parent920543faa4d789aa2417331a77bb8383574efab0 (diff)
downloadlibepoxy-8022cda75d65f537c48d4b43b44879abe558c1b7.tar.gz
Don't forget to tell our users that the epoxy GL functions are __dllimport.
This lets the compiler generate faster function calls (call through function pointer, instead of call into a linker-generated stub func containing jump to function pointer).
-rw-r--r--include/epoxy/gl.h5
-rw-r--r--src/dispatch_common.h1
-rwxr-xr-xsrc/gen_dispatch.py8
3 files changed, 9 insertions, 5 deletions
diff --git a/include/epoxy/gl.h b/include/epoxy/gl.h
index 8e0d2d1..c70a8d6 100644
--- a/include/epoxy/gl.h
+++ b/include/epoxy/gl.h
@@ -47,6 +47,7 @@ extern "C" {
/* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
#define APIENTRY
#define GLAPIENTRY
+#define EPOXYAPIENTRY
#define GLAPI
#else
#ifndef APIENTRY
@@ -57,6 +58,10 @@ extern "C" {
#define GLAPIENTRY APIENTRY
#endif
+#ifndef EPOXYAPIENTRY
+#define EPOXYAPIENTRY __declspec(dllimport)
+#endif
+
#ifndef GLAPI
#define GLAPI extern
#endif
diff --git a/src/dispatch_common.h b/src/dispatch_common.h
index d456066..7f317a4 100644
--- a/src/dispatch_common.h
+++ b/src/dispatch_common.h
@@ -27,6 +27,7 @@
#define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 1
+#define EPOXYAPIENTRY __declspec(dllexport)
#elif defined(__APPLE__)
#define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX 1
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py
index 496256d..4da840a 100755
--- a/src/gen_dispatch.py
+++ b/src/gen_dispatch.py
@@ -506,16 +506,14 @@ class Generator(object):
self.outln(' */')
self.outln('#ifdef _WIN32')
self.outln('#define EPOXY_FPTR(x) x')
- self.outln('#define EPOXY_FPTR_EXTERN')
self.outln('#else')
self.outln('#define EPOXY_FPTR(x) (*x)')
- self.outln('#define EPOXY_FPTR_EXTERN extern')
self.outln('#endif')
for func in self.sorted_functions:
- self.outln('EPOXY_FPTR_EXTERN {0} EPOXY_FPTR(epoxy_{1})({2});'.format(func.ret_type,
- func.name,
- func.args_decl))
+ self.outln('extern EPOXYAPIENTRY {0} EPOXY_FPTR(epoxy_{1})({2});'.format(func.ret_type,
+ func.name,
+ func.args_decl))
self.outln('')
for func in self.sorted_functions: