DEBUGGING without DEBUG
Re: DEBUGGING without DEBUG
So i need to float my boat to (codeblocks with mingw64) land and drink a bottle of debug for breakfast 
Re: DEBUGGING without DEBUG
what can i say
with the work i put in it im pretty happy with my compiler hehe.
Productivity is a state of mind.
-
Knightmare
- Posts: 63
- Joined: Thu Feb 09, 2012 1:55 am
Re: DEBUGGING without DEBUG
It was the byte order functions, or more specifically the function pointers that are bound on startup after detecting byte order. I did a build that bypassed them, hardcoding function calls, and it worked perfectly. After referring to the RtCW source, I found that the pointers needed to be static to work right with newer Visual Studio versions.
Here's the fixed code in q_shared.c:
Here's the fixed code in q_shared.c:
Code: Select all
// can't just use function pointers, or dll linkage can
// mess up when qcommon is included in multiple places
// Knightmare- made these static
static short (*_BigShort) (short l);
static short (*_LittleShort) (short l);
static int (*_BigLong) (int l);
static int (*_LittleLong) (int l);
static qint64 (*_BigLong64) (qint64 l);
static qint64 (*_LittleLong64) (qint64 l);
static float (*_BigFloat) (float l);
static float (*_LittleFloat) (float l);
short BigShort(short l){return _BigShort(l);}
short LittleShort(short l) {return _LittleShort(l);}
int BigLong (int l) {return _BigLong(l);}
int LittleLong (int l) {return _LittleLong(l);}
qint64 BigLong64 (qint64 l) {return _BigLong64(l);}
qint64 LittleLong64 (qint64 l) {return _LittleLong64(l);}
float BigFloat (float l) {return _BigFloat(l);}
float LittleFloat (float l) {return _LittleFloat(l);}
Re: DEBUGGING without DEBUG
nice catch
this should also apply to quake 1
Productivity is a state of mind.
Re: DEBUGGING without DEBUG
Thanks Knightmare!
Re: DEBUGGING without DEBUG
noticed for gcc you need to call the static function pointers instead of the prototype or it will fail to build with invalid lvalue.
so in quake1's common.c call them like this _BigShort = ShortSwap etc.
so in quake1's common.c call them like this _BigShort = ShortSwap etc.
Productivity is a state of mind.