'Importing' SIMPL# Libraries in Crestron Studio®


Crestron Studio® provides functionality to utilize user-created SIMPL# libraries in Crestron Studio® systems. Note that SIMPL# libraries are NOT imported using the standard import functionality in Crestron Studio®. Instead, SIMPL# libraries should be referenced in a new or existing SIMPL+ module(s).

IMPORTANT: The SIMPL# library and the SIMPL+ module referencing the library cannot have the same name. If they do, compilation error will occur!

To start using a SIMPL# library in a Crestron Studio® system:

  1. Create new or open existing SIMPL+ module. Make sure that the name of the module differs from the name of the SIMPL# library.

  2. Copy the SIMPL# library file (extension .clz) to the same folder where the SIMPL+ module is located.

    Central SIMPL+ modules reside in 'C:\Users\Public\Documents\Crestron\Tools\Modules'.

    Project specific SIMPL+ modules are saved in 'C:\Users\USER_NAME\Documents\Crestron\Projects\Systems\SYSTEM_NAME\Modules\'.

  3. Reference the SIMPL# Library within the SIMPL+ module by using the SIMPL+ compiler directive #USER_SIMPLSHARP_LIBRARY "library_name" in the 'Include Libraries' section of the SIMPL+ module.



    Note that "library_name" is the name of the SIMPL# library without the file extension.

    For example, #USER_SIMPLSHARP_LIBRARY “MyLibrary” references MyLibrary.clz.

    NOTE: The name of the SIMPL# library cannot include relative or absolute paths. Additionally, Crestron recommends that the compiler directive #INCLUDEPATH is not used in SIMPL+ modules utilized in Crestron Studio® as referencing paths outside of the Central and Project databases may break dependencies during module export.

  4. Call and use class' functions and variables from the SIMPL# library in your SIMPL+ module

  5. Compile and use the SIMPL+ module.

All public classes and their public class members (variables, methods and properties) in a SIMPL# Library are exposed to the SIMPL+ module so you can create variables of this class type in your SIMPL+ module and then call and use the class’ functions and variables as needed..

 

To access a class defined in the SIMPL# library and call its methods and properties from a SIMPL+ module:

  1. Reference the SIMPL# library in the SIMPL+ module:

    For example: #USER_SIMPLSHARP_LIBRARY "SIMPLSharpLibrary1"
  2. Create an instance of the class defined in the SIMPL# Library by declaring a variable (myClass) of the same type as the SIMPL# class:

    For example: Class1 myClass;

  3. Call the methods and properties of the class, by using the class variable name and the dot operator. For example, to call the method GetID() of Class1 from the SIMPL# example above, use:

    SIGNED_LONG_INTEGER ID;

    ID = myClass.GetID();


    NOTE: Names of classes, structures and variables defined in SIMPL# are case-sensitive, so make sure to use their correct names when referencing them in your SIMPL+ module!

SIMPL+:

      function InitializeSimplSharpObjects()

{

Class1 myClass; // instantiate a variable of SIMPL# class in the SIMPL+ module

SIGNED_LONG_INTEGER ID;

ID = myClass.GetID();

           }