Skip to main content

Command: Generate Runtime System Files

Function: The command generates a C stub file and an M4 interface file from the current library project. These files are used as the basis for creating an external library file.

Call: Build menu

Requirement: A library project is open.

The command opens the Generate Files for Runtime System dialog.

Output directory

Directory where CODESYS creates the runtime system files

Click the _cds_icon_button_threedots.png button to open the default dialog for browsing the file system.

Component name

Name of the library project

Which files do you want to create?

M4 interface file

_cds_icon_checked.png: Interface file <project name>Itf.m4 with definitions

See also the table below with the IEC code constructs supported for M4 export.

Example of M4 file:

m4_interface_file_example.png

C stub file

_cds_icon_checked.png: Stub file for the reprogramming the library in C

Example of stub file:

c_stub_file_example.png

Options

Export referenced types included in libraries

_cds_icon_checked.png: The referenced types are included in the export.

Use original type names

_cds_icon_checked.png: The type names from the library project are used.

IEC constructs which are supported for M4 export

Important

All types which are not explicitly listed in the table are not supported. Their behavior can change unnoticed.

IEC construct and language means

Export to M4 file

Note

PROGRAM

Not supported

FUNCTION_BLOCK

struct with all input/output/inoutput/local variables

In addition, a method named <fb_name>__main is created for the implementation of the FUNCTION_BLOCK.

FUNCTION

STRUCT with all input/output/inoutput/local variables and a DEF_API macro

INTERFACE

struct with a single instance pointer

METHOD

Same as FUNCTION, named <fb_name>__<method_name>, which uses the pointer to <fb_name> as an additional input

ACTION

Same as METHOD

TRANSITION

Same as METHOD, named get<transition_name>

PROPERTY

Method pair named get<prop_name> and set<prop_name>

GVL

Not supported

UNION

C-union

ENUM

#define for each enumeration component

ALIAS

Not supported

STRUCT

C-struct

Inheritance is supported. The components are exported "flat" (without structure)

CONSTANT

#define for each constant

Constants cannot be exported explicitly, but if they are used in the other objects, then they are automatically exported.

Comments

C comment

Comments with three slashes are also exported.

Predefined data types (INT, BOOL, REAL, etc.)

Corresponding C data type of the same size

Types beginning with RTS_IEC

Are not exported separately because they are declared elsewhere in the runtime system

ANY types

struct __SYSTEM.AnyType

All ANY types (for example, ANY_INT, ANY_BIT, etc.) are exported to the C type struct __SYSTEM.AnyType.

Arrays

C array with fixed size

  • Any number of dimensions

  • Array areas can be negative.

ARRAY[*]

One pointer and one size

Strings

C array of characters with fixed size