Skip to main content

Command: Implement interfaces

Function: The command updates the implemented interfaces for a function block.

Call: Context menu of the selected function block (FB) in the device tree

Requirement: The function block implements an interface which you have changed. For example, an additional method has been added to the interface.


In object-oriented programming, if you derive a function block (FB) from a base function block, which implements one or more interfaces for the purpose of inheritance, then the following applies:

When you execute the Implement interfaces command for the derived FB, all interface methods and interface attributes of the base FB are applied to the derived FB in the form of "stubs" (without implementation). Then you are responsible for making sure that an "empty" method or attribute in the derived FB does not conflict with an implemented one in the base FB. To help you with this: the following happens: If there is a base implementation for a method or attribute, then CODESYS adds an {error..} pragma attribute in the first line of the relevant derived interface method or interface attribute which will generate the error message. If there is not a base implementation for the method or attribute, then it provides a pragma attribute entry for a warning. After editing the POU, you have to explicitly remove the error pragma attribute entry.

For more information, see: Implementation of an Interface