SysCpuCallIecFuncWithParams (FUN)

FUNCTION SysCpuCallIecFuncWithParams : RTS_IEC_RESULT

Call an IEC function from plain C code. Since different CPU’s/systems use different calling conventions, this function should be used as a wrapper. IEC functions or methods of function block use all the same calling convention: They have no return value and exactly one parameter, which is a pointer to a struct that contains all required IN and OUT parameters.

NOTE: A call to the function SysCpuCallIecFuncWithParams with the parameter values <pointer (not equal to NULL)> in pParam and <0> in iSize has the same result as a call with the parameter values <NULL pointer> in pParam and <0> in iSize. Both result in a call without parameters of the function passed in parameter pfIECFunc.

IN GENERAL: An IEC function must always be called with the parameters according to its definition. If an IEC function is called with parameters which do not correspond to the definition of the IEC function, the CODESYS Control runtime system may CRASH.

RETURN: Returns the runtime system error code (see CmpErrors.library) <SIL2/>

InOut:

Scope

Name

Type

Comment

Return

SysCpuCallIecFuncWithParams

RTS_IEC_RESULT

Input

pfIECFunc

POINTER TO BYTE

Pointer to the IEC function that should be called

pParam

POINTER TO BYTE

Pointer to the parameter struct that contains the function parameters. Can be 0 if not used.

ulSize

UDINT

Size of the parameter structure to copy the content on stack. Can be 0.