Step 7 - Deploying new FBs with the Dynamic Type Loader

This page is part of a guide that gives a walk-through of the major 4diac IDE features.

  1. 4diac IDE Overview
  2. Use 4diac Locally (Blinking tutorial)
  3. Distribute 4diac Applications
  4. Deploy Applications Remotely
  5. Create Your own Function Block Types
  6. Other Basic Features
  7. Advanced Features
  8. Deploying new FBs with the Dynamic Type Loader (YOU ARE HERE!)

In this tutorial, you will learn how to deploy and test your function blocks, without compiling and adding them to the 4diac FORTE .

Each time you created new function blocks, a new 4diac FORTE has to be compiled. This takes time, which is wasted just for compiling. Therefore, we have a feature called "Dynamic Type Loader". With this feature, new functions blocks can be deployed and tested without the need to compile them. Instead of directly compiled into the 4diac FORTE, the FBs are downloaded as LUA Code and a Lua-Interpreter, running inside the FORTE, interprets this code then.

Downloading the Compiler

Before we can use the Dynamic Type Loader, we have to compile a new FORTE with the Lua JIT (Just-In-Time Compiler). Therefore we are going to need a c-compiler. If you have done the tutorial, on how to create your own forte, everything you need should already be installed. Otherwise, follow the steps here.

We recommend using the minGW compiler.

Downloading Lua

Now we need to download the Lua source code and build the libraries. We are using this site. Open the folder, you want to build Lua in. Start Git Bash there and enter this commands:

$ git clone http://luajit.org/git/luajit-2.0.git $ cd luajit-2.0 $ make

The libs should be successfully created.

Compile Lua Jit

Compiling Forte with the LuaJit

At first download the 4diac FORTE source from here or clone the 4diac FORTE repository.

$ git clone https://github.com/eclipse-4diac/4diac-forte.git

Then create an folder where we are going to build our 4diac FORTE in. Open CMake and set the source folder, to the folder where your 4diac FORTE source files are in. Then set the build folder, to folder where you want to build the 4diac FORTE in.

Before configuring the Lua options, please enable all options, shown in this tutorial. Before pressing generate, we have to configure all Lua options.

  1. Set FORTE_USE_LUATYPES to LUAJIT and press configure
  2. For LUAJIT_INCLUDE_DIR choose the folder, where your compiled library is in, YOUR_FOLDER/src/.
  3. For LUAJIT_LIBRARY choose the Lua51.dll which should be in your folder where compiled Lua under YOUR_FOLDER/src/Lua51.dll
  4. Press Configure. All red marked lines should be gone. At last press generate, open Git Bash in your build folder and enter
    make

You should have now successfully built your 4diac FORTE with the integration of the Lua JIT compiler.

Compile Forte

Enabling the Dynamic Type Loader

Before you can use theDynamic Type Loader, you have to enable it in the 4diac IDE.

  1. Then choose your system application, where you can see all your resources
  2. Then choose the FORTE resources, where you want to deploy the new FBs to
  3. In the properties tab, change the profile above the "Inputs" of the tab, to "DynamicTypeLoad"
Enable DTL

Everthing should be set up and you can deploy your FBs, like you learned earlier in the tutorial, without compiling a new FORTE.