GameMonkey Script
http://www.gmscript.com/gamemonkey/forum/

#if 1 // Compatible with 64bit OS (better way?)
http://www.gmscript.com/gamemonkey/forum/viewtopic.php?f=6&t=608
Page 1 of 1

Author:  Zartox [ Tue Jul 24, 2012 12:03 pm ]
Post subject:  #if 1 // Compatible with 64bit OS (better way?)

Line 415 of .../binds/gmSystemLib.cpp:
#if 1 // Compatible with 64bit OS
and similar line 587:
#if 1 // Compatible with 64bit OS

For me #if 0
would have been a better value.

Seriously, I don't know, but I guess that there exist some defined value that would allow for testing for 64 bits?
A fast Googling give me this: http://stackoverflow.com/questions/1505 ... 4-bit-in-c

#if ((ULONG_MAX) == (UINT_MAX))
# define IS32BIT
#else
# define IS64BIT
#endif

or this:
// Check windows
#if _WIN32 || _WIN64
#if _WIN64
#define ENVIRONMENT64
#else
#define ENVIRONMENT32
#endif
#endif

// Check GCC
#if __GNUC__
#if __x86_64__ || __ppc64__
#define ENVIRONMENT64
#else
#define ENVIRONMENT32
#endif
#endif

Author:  Greg [ Wed Jul 25, 2012 9:56 am ]
Post subject:  Re: #if 1 // Compatible with 64bit OS (better way?)

Welcome to the forum Zartox :) And thanks for posting and answering posts.

There is a GM_PTR_SIZE_64 / 32 defined in the platform config files. This should use define _M_X64 (which I think has some portability beyond MSVC).
Whichever way, GM_PTR_SIZE_64 should be set in the platform config and should be used in the gmSystemLib.cpp instead of #if 1 / 0.

I recall the system lib being hacked to work on some 64bit platform (hence the #if 1) long before the whole project had a pass at 64bit compatibility (the GM_PTR_SIZE_64). The non-windows platform configs have not been updated in my build so they are from the time when everything was incorrectly typed as 'gmptr' which was an 'int'.

I'll try to clean some of this up soon in my build.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/