Native calling convention support for mingw x64
We're using mingw to cross compile our binary files for 2 different architectures: lin/win X x86/x64. Now that we've discovered that native calling convention is only supported for x64 when compiled by msvc, what is required to get it working under mingw?
If it fails, please let me know which of the tests that fail and I'll help you figure out what needs to be modified to get it working.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
So I played around with a little.. Here's the first problem: mingw-w64 doesn't seem to define __LP64__ and indeed, sizeof(long) is 4. as_config.h seems to enable NCC for gcc only in case when __LP64__ is present. So where should I go from this?
It is necessary to determine what predefine that can be used to identify a 64bit target. There must be something instead of __LP64__ that can be used.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
#define _WIN64 1
#define __DBL_DENORM_MIN__ ((double)4.94065645841246544177e-324L)
#define __x86_64 1
#define __UINT_FAST64_MAX__ 18446744073709551615ULL
#define __DEC64_MAX_EXP__ 385
#define __UINT_LEAST64_MAX__ 18446744073709551615ULL
#define __INT64_C(c) c ## LL
#define __WIN64 1
#define __INT32_MAX__ 2147483647
#define __INT_FAST32_MAX__ 2147483647
#define __INT64_MAX__ 9223372036854775807LL
#define __INT_LEAST32_MAX__ 2147483647
#define __amd64 1
#define __INT_FAST64_TYPE__ long long int
#define __UINT64_C(c) c ## ULL
#define __DEC64_EPSILON__ 1E-15DD
#define __UINT64_MAX__ 18446744073709551615ULL
#define __SIG_ATOMIC_MAX__ 2147483647
#define __x86_64__ 1
#define __UINT_LEAST64_TYPE__ long long unsigned int
#define __LONG_MAX__ 2147483647L
#define __DEC64_MAX__ 9.999999999999999E384DD
#define __DEC64_MANT_DIG__ 16
#define __INT_LEAST64_TYPE__ long long int
#define __LDBL_MANT_DIG__ 64
#define __DEC64_MIN_EXP__ (-382)
#define __INT_FAST64_MAX__ 9223372036854775807LL
#define __UINT_FAST64_TYPE__ long long unsigned int
#define __INT_MAX__ 2147483647
#define __amd64__ 1
#define __INT64_TYPE__ long long int
#define WIN64 1
#define __INT_LEAST64_MAX__ 9223372036854775807LL
#define __DEC64_MIN__ 1E-383DD
#define __UINT64_TYPE__ long long unsigned int
#define __MINGW64__ 1
#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
#define _INTEGRAL_MAX_BITS 64
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
#define __WIN64__ 1
The relevant options are -E -dM
It may be necessary to check in angelscript.h how the INT64 and QWORD types are typedefed. It should be with 'long long'.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
#ifdef __LP64__
typedef unsigned int asDWORD;
typedef unsigned long asQWORD;
typedef long asINT64;
#else
typedef unsigned long asDWORD;
#if defined(__GNUC__) || defined(__MWERKS__)
typedef unsigned long long asQWORD;
typedef long long asINT64;
#else
typedef unsigned __int64 asQWORD;
typedef __int64 asINT64;
#endif
#endif
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
AngelScript version: 2.21.0
AngelScript options: AS_64BIT_PTR AS_WIN AS_X64_GCC
to console. Looks like it's going to be a bumpy ride
These tests start at line 303 in the test_feature/source/main.cpp file. Comment out the tests above those until all the tests for the native calling conventions work.
If you post the errors you get I can help figure out the changes that needs to be made.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game