Runtime source dependencies

Doug Binks edited this page Aug 3, 2015 · 3 revisions

Sometimes it's easier to add a source file dependency that create a library to use from RCC++. A runtime source dependency can be specified by using the following in a header:

#include "RuntimeSourceDependency.h"
RUNTIME_COMPILER_SOURCEDEPENDENCY;

This will cause compilation of the source file with the same name as the header file, but with the extension .cpp. Thus if the header with the above code in is called "myheader.h" the source file "myheader.cpp" will be compiled alongside any runtime modifiable code. We hope in future to add more general situations.

If the header is also a Runtime modifiable header files then the source code will be tracked for changes, causing a compilation of any dependent runtime modifiable code. This is useful when you need to add runtime modifiable code which does not fit well with using Runtime Modifiable Classes, however the programmer needs to maintain any state between compiles.

Two alternative versions of the macro exist for handling the case of a different extension, and a different file.

#include "RuntimeSourceDependency.h"
RUNTIME_COMPILER_SOURCEDEPENDENCY_EXT(".c");
RUNTIME_COMPILER_SOURCEDEPENDENCY_FILE("AnotherSourceFile",".cpp");