Describe the bug
Input variables of structs should be passed as (const) pointer.
To Reproduce
I have the following struct defined in plc:
TYPE
TIME_SYSTIMEDATE : STRUCT
Sec : DINT; (**< Seconds after the minute [0..60], leap second allowed *)
Min : DINT; (**< Minutes after the hour [0..59] *)
Hour : DINT; (**< Hours since midnight [0..23] *)
Day : DINT; (**< Day of the month [1..31] *)
Month : DINT; (**< Months since January [0..11] *)
Year : DINT; (**< Absolute year (e.g. 2025) *)
Wday : DINT; (**< Days since Sunday [0..6], 0 = Sunday *)
Yday : DINT; (**< Days since January 1 [0..365], 0 = Jan 1 *)
Isdst : DINT; (**< -1 = unknown, 0 = off, 1 = on *)
Gmtoff : DINT; (**< Seconds east of UTC *)
Zone : STRING[64]; (**< Timezone name/abbreviation (NUL-terminated) *)
END_STRUCT;
END_TYPE
which is then correctly generated in to a c struct definition typedef struct { ... } TIME_SysTimeDate;
When using it as VAR_INPUT I would hope it to get passed as a pointer in C (const would also be nice). In that case the struct does not need to be copied, which in the TIME_SYSTIMEDATE case would be a lot of data.
Expected behavior
When handed to a function, I expect my struct to be passed as a const pointer:
void someFunction(const TIME_SysTimeDate* sysTimeVar)
{
// Implementation here...
}
Additional context
Orignally reported by Guillaume.
Describe the bug
Input variables of structs should be passed as (const) pointer.
To Reproduce
I have the following struct defined in plc:
which is then correctly generated in to a c struct definition
typedef struct { ... } TIME_SysTimeDate;When using it as
VAR_INPUTI would hope it to get passed as a pointer in C (const would also be nice). In that case the struct does not need to be copied, which in theTIME_SYSTIMEDATEcase would be a lot of data.Expected behavior
When handed to a function, I expect my struct to be passed as a const pointer:
Additional context
Orignally reported by Guillaume.