[vlc-devel] [PATCH] qt: Fix linking EGL from QtANGLE on windows on i386
Martin Storsjö
martin at martin.st
Fri May 22 14:04:20 CEST 2020
Define EGLAPI instead of KHRONOS_STATIC to indicate static linking,
as defining KHRONOS_STATIC surprisingly not only affects linkage, but
also affects the calling convention (normally the EGL functions are
stdcall, but with KHRONOS_STATIC defined, they become cdecl).
---
Alternatively, we could tweak the Qt patch for adding support for
KHRONOS_STATIC, to not affect __stdcall. I commented on this upstream
at https://github.com/KhronosGroup/EGL-Registry/commit/94ba8ee876206364cf45a9bc08b8db5a52cb9543#r39362613,
let's see if there's any response, because to me, it looks like that's
the actual original bug.
---
.../qt/maininterface/compositor_dcomp_uisurface.hpp | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.hpp b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.hpp
index 34628ea011..67454c54be 100644
--- a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.hpp
+++ b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.hpp
@@ -34,8 +34,17 @@
#include <qconfig.h>
//we link statically with ANGLE
-#if defined(QT_STATIC) && !defined(KHRONOS_STATIC)
-# define KHRONOS_STATIC 1
+#if defined(QT_STATIC) && !defined(EGLAPI)
+// One could consider defining KHRONOS_STATIC, but surprisingly, defining
+// KHRONOS_STATIC not only makes KHRONOS_APICALL empty instead of
+// __declspec(dllimport), but it also makes KHRONOS_APIENTRY empty instead
+// of being set to __stdcall as it is otherwise.
+// Therefore, using KHRONOS_STATIC would require it to be used in the same
+// way when building the EGL implementation, and that's currently not the
+// case with QtANGLE. Therefore, don't define KHRONOS_STATIC but just define
+// EGLAPI instead, to avoid it expanding to KHRONOS_APICALL. This matches
+// how QtANGLE is built.
+#define EGLAPI
#endif
#include <QObject>
--
2.17.1
More information about the vlc-devel
mailing list