Function Block — Calling Functions or Methods with External Implementation
A runtime system can include the implementation of a function block, function, or method (for example, from a library). If you create a POU in your application with the same name by using the External implementation without an implementation, then you can execute the existing implementation. Note here that you declare local variables only in an external function block. External functions and methods must not contain local variables.
When the application is downloading, CODESYS searches for and links the associated implementation in the runtime system for each external POU.
Tip
Objects with the property External implementation are postfixed with (EXT)
after the object name in the Devices or POUs view.
For more information, see: Build
Creating POUs with external implementation
Click
.Activate Function block, Method, or Function and specify the name of the associated implementation of the runtime system. Close the dialog by clicking Add.
The runtime system POU is created in the POUs view. The name is postfixed with
(EXT)
.Right-click the POU and select Properties.
The dialog opens.
Click the Build tab.
Select the External implementation (Late link in the runtime system) option.
The POU is declared and you can implement a POU call.
Creating methods with external implementation
Select a function block in the device tree or in the POU view.
Select Add to exit the dialog.
and specify the name of the associated implementation of the runtime system. ClickThe method is created.
Right-click the method and select Properties.
The dialog opens.
Click the Build tab.
Select the External implementation (Late link in the runtime system) option.
The method is declared and you can implement a method call. The method name is postfixed with
(EXT)
in the Devices or POUs view.