|Top Previous Next|
Using the INTERFACE / IMPLEMENTATION functionality it is possible to split a FUNCTION and FUNCTION_BLOCK into two sections. One section that caters for the interface and another section that caters for the actual implementation.
Using this separation it is possible to expose the interface in a separate INC file and then the implementation can be in another INC file that may be encrypted.
Another advantage with this separation is to break dependencies in large program complexes, such that as soon as the INTERFACE has been declared, then other parts of the code can reference the function / function block.
Example of usage:
FUNCTION INTERFACE funcA:INT
a : INT;
b : DOUBLE;
// Notice that no local variables are allowed in the interface section.
p : INT;
//This function references funcA, where only the interface is defined.
p := funcA(a := 10,b := 27.14);
FUNCTION IMPLEMENTATION funcA; // return value cannot be specified here.
//No VAR_INPUT is allowed here.
aaa : INT; //Local variables are allowed here.