title: "Step 7 - Deploying new FBs with the Dynamic Type Loader" url: doc/tutorials/dynamictypeloader.html ---

# 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.

0. 4diac IDE Overview

1. Use 4diac Locally (Blinking tutorial)

2. Distribute 4diac Applications

3. Deploy Applications Remotely

4. Create Your own Function Block Types

5. Other Basic Features

6. Advanced Features

7. Deploying new FBs with the Dynamic Type Loader (YOU ARE HERE!)

8. Deploying Applications with OPC UA

In this tutorial, you will learn how to deploy and test your function blocks, without compiling and adding them to 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 4diac FORTE, the FBs are downloaded as LUA Code and a Lua-Interpreter, running inside 4diac FORTE, interprets this code then.

## Downloading the Compiler

Before we can use the Dynamic Type Loader, we have to compile a new 4diac 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 4diac 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 LuaJit. 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.

## Compiling 4diac Forte with the LuaJit

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

    $ git clone https://github.com/eclipse-4diac/4diac-forte.git.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 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.

## 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 4diac 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"

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

## Where to go from here?

- If you want to continue and check out deploying Applications with OPC UA, here is a link
  Deploying Applications with OPC UA

- If you want to go back to the Start Here page, we leave you here a fast access:
  Where to Start

Go to top