|
Important |
|---|---|
|
|
|
Note |
|---|---|
|
This functionality is supported from compiler version 3.4.1.0. |
The effect of this pragma is that a method is called implicitly after the initialization of a function block instance. For reasons of performance you have to add the attribute both to the function block and to the method in its own first line above the declaration part.
A method with this pragma is called after the FB_Init method and after the variable value of an initialization expression has been valid in the instance declaration.
Syntax:
{attribute 'call_after_init'}
Call: First line above the declaration part of the method and the function block
Example 257. example
Definition
{attribute 'call_after_init'}
FUNCTION_BLOCK FB_DoIt
... <functionblock definition>
{attribute 'call_after_init'}
METHOD FB_AfterInit
... <method definition>
The declaration implements the following declaration in the subsequent code processing:
fbDoIt : FB_DoIt := (in1 := 99);
Code processing
fbDoIt.FB_Init(); fbDoIt.in1 := 99; fbDoIt.FB_AfterInit();
This allows a reaction to the user-defined initialization in FB_AfterInit.