Game Development Community

DSO compilation bug with fix

by Tim Newell · in Torque 3D Professional · 11/05/2012 (12:21 pm) · 2 replies

Build: 1.2
Platform: Windows 7
Target: Game

Issues: If you have DSO generation on and you make changes to script files, you will not see your changes until you delete the dsos as it loads older dsos over newer cs files.

Steps to Repeat:
1. Turn on dso generation in the exe.
2. run game so dsos are generated.
3. make a change to a cs file.
4. run game again and see your change is not there.

Suggested Fix: This is actually an easy fix. in console/consoleFunctions.cs in the function DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool journalScript ), ( false, false ) you will see the following code:

if(compiled && dsoFile != NULL && (scriptFile == NULL|| (scriptModifiedTime - dsoModifiedTime) > Torque::Time(0)))

replace it with:
if(compiled && dsoFile != NULL && (scriptFile == NULL|| (dsoModifiedTime - scriptModifiedTime) > Torque::Time(0)))

It was just doing subtraction in the wrong order.


#1
11/05/2012 (12:57 pm)
My suggestion is to use this fix instead since the Torque::Time(0) makes absolutely no sense at all after reviewing the Torque's Time class:
if(compiled && (dsoFile != NULL) && (scriptFile == NULL || (dsoModifiedTime >= scriptModifiedTime)))

UPDATE: Fixed time stamp comparison. Thought if() was for know when to recompile script file, but it is in fact to determine if DSO should be loaded.
#2
02/03/2013 (4:23 am)
"since the Torque::Time(0) makes absolutely no sense at all after reviewing the Torque's Time class"

what that means!?