I think the issue is that the compiler cannot take a function as a value/variable for a function block input in a declaration.
When you do the first and 3rd declaration, you link the input to a variable. But with 2nd one, you link it to the result of a function.
π
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, I have written a custom logger and wanted to add the name of POUs as the
pszComponent
for easier debugging.I wrote a custom
FB_init
which accepts as input the name of the POU as a string and encountered puzzling behavior (to me at least).Could someone explain to me why the following compiles
but the following
throws the following compiler error?
Is it because
__POUNAME()
behaves like a function block instead of a function like I assumed?Which is why
also works if I change the input to a string pointer?
Last edit: void 2021-12-13
I think the issue is that the compiler cannot take a function as a value/variable for a function block input in a declaration.
When you do the first and 3rd declaration, you link the input to a variable. But with 2nd one, you link it to the result of a function.
Cool that seems similar to the comments I got from https://stackoverflow.com/questions/70333886/about-pouname-behavior