Block Developers

1 - Detecting the ExtendSim version custom blocks are being used in.

There are two levels of ExtendSim 10 definitions:

  • Compile Time • If you are compiling a block in ExtendSim 10, EXTENDSIM_10 is defined by the compiler so can be used in block code with a value of 1. Your block code might be similar to:

#ifdef EXTENDSIM_10
    #include "v10 include file.h"
    and some v10 compatible code;    // note that this can use V10 functions that are not defined in V9 as v9 will ignore this
    #include "v9 include file.h"
    and some v9 compatible code;

  • Run Time • Your block could call GetExtendVersion(0), which returns a double of 1000.0 or greater for version 10.xx. Your block code might be similar to:

if (GetExtendVersion(0) >= 1000.0)
    do something that v10 needs (must use v9 compatible functions if you need to run this block in v9);
    do something that v9 needs;