El 1/12/20 a les 11:00, LacaK via fpc-pascal ha escrit:
Thank you, yes it works. I have used:
const
MyConst1: AnsiString = 'abc'
MyConst2: TMyRec = (a: @MyConst1[1]);
It doesn't compile with fpc 3.2.0 (I'm trying, without success so far,
your open62541 translation).
In order to compile your TestOpcUa1 I had to change the definition to
MyStructTypeName1 = 'MyStructTypeName'; // untyped
constant for for Length()
MyStructTypeName2: Array[1..length(MyStructTypeName1)] of char =
MyStructTypeName1; // typed constant for @
and then use @MyStructTypeName1 (without the [1]) in the record definition.
Note that without the [1] it would also compile with an ansistring, but
then the pointer wouldn't point at the first character of the string.
Bye
--
Luca
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal