31 July 2013

Added runtime compile of source dependencies, and improved compiler support.

The latest update adds support for the runtime compile of source dependencies, significantly enhancing the amount and type of code which can be runtime compiled. Additionally, I've improved compiler support amongst other changes. Full details below.

Runtime compile of source dependencies

If you have a header which adds a source dependency, and you also mark that header as being runtime modifiable, the runtime object system will now track both the header and the source file for changes and recompile them along with any runtime compiled code which includes the header.

This allows pretty much any code to be runtime compiled so long as the source and header names are in the format name.h and name.cpp, and you can add the following to the header:

#include "RuntimeSourceDependency.h"

#include "RuntimeInclude.h"

Note that in order for this to work properly, the header must be included from a source file which uses the REGISTERCLASS macro on an IObject based class  (either directly or via another header). This is because the program needs to preserve state somehow across compiles, and currently the IObject class handles this.

Take care using this feature, as it can be easy to introduce changes which break the code - though in practice I've found this very useful.

Improved compiler support

  • Added support for Visual Studio 2013 - however this is as yet untested.
  • Added support for cross compile to 32bit on 64bit Linux/MacOSX systems, thanks to Gaoren Xu for discovering this issue and helping with the solution.

Singleton support

At the request of a project using RCC++ I've improved support for singleton type classes. This is especially useful as a good practice in using RCC++ in a performant way is to have singleton system classes which operate on arrays of data.

The REGISTERSINGLETON macro takes a class name and a boolean as arguments, where the boolean controls auto construction of the class. This macro causes the constructor to only ever make one instance of the class. For an example look at the MainObject.cpp file in SimpleTest where we use the macro as:


to auto construct an instance of the MainObject class during the Initialise call of RuntimeObjectSystem.

Cleaning build temporaries

Build temporaries can now be cleaned up using the RuntimeObjectSystem::CleanObjectFiles() call, which uses the new FileSystemUtils::PathIterator class. The demos currently do this when the program ends.