Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

Building on Windows using gcc - compiler vs. environment #ifdefs

$
0
0

I've been using SystemC for years on Linux with gcc and Windows with Visual Studio.  I decided to try it out in Eclipse on windows with the Cygwin environment.

 

Several problems have popped up.  For example there are #ifdefs around defining data types supported by the compiler, such as __int64 in the Microsoft compiler versus long long elsewhere.  However these are defined based on the _WIN32 predefined macro.

 

That's not really correct, it should be defined based on the compiler type - in this case using _MSC_VER instead of _WIN32.

 

Example from sc_nbdefs.cpp

 

 

// Support for the long long type. This type is not in the standard
// but is usually supported by compilers.
#if !defined(_WIN32) || defined(__MINGW32__)
const uint64 UINT64_ZERO   = 0ULL;
const uint64 UINT64_ONE    = 1ULL;
const uint64 UINT64_32ONES = 0x00000000ffffffffULL;
#else
const uint64 UINT64_ZERO   = 0i64;
const uint64 UINT64_ONE    = 1i64;
const uint64 UINT64_32ONES = 0x00000000ffffffffi64;
#endif

Viewing all articles
Browse latest Browse all 595

Trending Articles