From 144cbc9325250081f2eb584ca5deb13aaf1c2433 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sun, 21 Mar 2021 19:02:58 +0000 Subject: [PATCH] Support Win64 pointer-sized types Since we're generating stub types from khrplatform.h because we can't include it reliably, we'll have to deal with some of the fallout of the Win64 types. Fixes: #246 --- src/gen_dispatch.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index d33f128..5115bf0 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -515,9 +515,17 @@ class Generator(object): self.outln('typedef uint32_t khronos_uint32_t;') self.outln('typedef uint64_t khronos_uint64_t;') self.outln('typedef float khronos_float_t;') - self.outln('typedef long khronos_intptr_t;') - self.outln('typedef long khronos_ssize_t;') - self.outln('typedef unsigned long khronos_usize_t;') + self.outln('#ifdef _WIN64') + self.outln('typedef signed long long int khronos_intptr_t;') + self.outln('typedef unsigned long long int khronos_uintptr_t;') + self.outln('typedef signed long long int khronos_ssize_t;') + self.outln('typedef unsigned long long int khronos_usize_t;') + self.outln('#else') + self.outln('typedef signed long int khronos_intptr_t;') + self.outln('typedef unsigned long int khronos_uintptr_t;') + self.outln('typedef signed long int khronos_ssize_t;') + self.outln('typedef unsigned long int khronos_usize_t;') + self.outln('#endif') self.outln('typedef uint64_t khronos_utime_nanoseconds_t;') self.outln('typedef int64_t khronos_stime_nanoseconds_t;') self.outln('#define KHRONOS_MAX_ENUM 0x7FFFFFFF')