Calling a function block, function or method with external implementation

Calling a function block, function or method with external implementation 1:

Only applicable in exceptional cases

The use of this functionality is only possible in special constellations. As a rule, you can ignore the external implementation option.

A runtime system may contain an implementation of a function block, function or method, for example from a library. If you create a POU of the same name with the property External implementation without implementation in your PLC project, you can execute the existing implementation. Make sure you use an external function block for declaring local variables. An external function or method may not contain local variables.

During the project download, TwinCAT finds the corresponding implementation in the runtime system for each external POU and links it.

Creating a POU with external implementation

1. In the context menu of the PLC project tree select the command Add > POU...
2. Enable the function block or function and enter the name of the corresponding runtime system implementation. Quit the dialog with Open.
The POU with the name of the runtime system POU has been created.
3. Select the POU and enable the Properties view.
4. Enable the option External implementation (late linking in the runtime system).
The POU is declared, and you can implement a call of the POU.

Creating a method with external implementation

1. Select a function block in the PLC project tree in the Solution Explorer.
2. In the context menu select the command Add > Method and enter the name of the corresponding runtime system implementation. Quit the dialog with Open.
The method is created.
3. Select the method and enable the Properties view.
4. Enable the option External implementation (late linking in the runtime system).
The method is declared, and you can implement a call of the method.