Hi,
I have created a Function in C# that uses IecString80 as input. There is no compile error in VS but when I compile it in PlcNext I get „Internal error“.
If I change it to a function block then it works fine.
Is it not possible to use string as input in functions in C#?
I had a similar experience where errors were not found until the library was consumed in PLCnext Engineer. It is possible to use a string as input. I have a working function using IecStringEx type input. I believe the trick is to use ref on strings or complex data types. Example:
[Input] ref IecStringEx StringInput
Hello Stefan,
I agree with Rob, the using of reference to IecStringEx datatype is the most efficient way. This saves memory and CPU time for copying string values.
The following C# Example can help to implement the function: CSharpExamples/FBWithString.cs at master · PLCnext/CSharpExamples (github.com)
BR Eduard