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.
- 4diac IDE Overview
- Use 4diac Locally (Blinking tutorial)
- Distribute 4diac Applications
- Deploy Applications Remotely
- Create Your own Function Block Types
- Other Basic Features
- Advanced Features
- 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.
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:
The libs should be successfully created.
Compiling Forte with the LuaJit
At first download the 4diac FORTE source from here or clone the 4diac FORTE repository.
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.
- Set FORTE_USE_LUATYPES to LUAJIT and press configure
- For LUAJIT_INCLUDE_DIR chose the folder, where your compiled library is in, YOUR_FOLDER/src/.
- For LUAJIT_LIBRARY chose the Lua51.dll which should be in your folder where compiled Lua under YOUR_FOLDER/src/Lua51.dll
- 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 Dynmic Type Loader
Before you can use theDynmic Type Loader, you have to enable it in the 4diac IDE.
- Then choose your system application, where you can see all your resources
- Then choose the FORTE resources, where you want to deploy the new FBs to
- In the properties tab, change the profile in the top right corner of the tab, to "DynamicTypeLoad"
Everthing should be set up and you can deploy your FBs, like you learned earlier in the tutorial, without compiling a new FORTE.