diff --git a/mex/sources/dynmex.h b/mex/sources/dynmex.h index 2bd07760c91e93de87ec0cc8256220c9a85dc453..a4a635e838f47ed8b30f2a719743fb9eef6205c8 100644 --- a/mex/sources/dynmex.h +++ b/mex/sources/dynmex.h @@ -1,5 +1,5 @@ /* - * Copyright © 2009-2020 Dynare Team + * Copyright © 2009-2023 Dynare Team * * This file is part of Dynare. * @@ -30,4 +30,18 @@ # define mxIsScalar(x) (mxGetM(x) == 1 && mxGetN(x) == 1) #endif +/* The int64_T and uint64_T type are broken under MinGW for MATLAB < R2015b + (they actually alias long integer types, which are 32-bit) */ +#if defined(MATLAB_MEX_FILE) && defined(__MINGW64__) && MATLAB_VERSION < 0x0806 +# define int64_T long long +# define uint64_T unsigned long long +#endif +#ifdef __cplusplus +static_assert(sizeof(int64_T) == 8, "The int64_T type is buggy"); +static_assert(sizeof(uint64_T) == 8, "The uint64_T type is buggy"); +#else +_Static_assert(sizeof(int64_T) == 8, "The int64_T type is buggy"); +_Static_assert(sizeof(uint64_T) == 8, "The uint64_T type is buggy"); +#endif + #endif