From my experience on KSS 8.3, the buffer array of the CAST_ functions must be locally declared.
So, for example, this code will result in a compiler error:
Code
DEF ExampleError( notLocalBuffer :IN )
DECL CHAR notLocaBuffer[]
DECL INT offset, aInt
offset = 0
CAST_FROM( notLocalBuffer[], offset, aInt )
END
while, this will give no error
Code
DEF ExampleOk( notLocalBuffer :IN )
DECL CHAR notLocaBuffer[], localBuffer[4]
DECL INT offset, aInt
DECL BOOL res
res = strCopy(localBuffer[], notLocalBuffer[])
offset = 0
CAST_FROM( localBuffer[], offset, aInt )
END
The same happens with CAST_TO.
Nothing changes if the buffer is declared as a global variable or if the buffer is passed by reference ( :OUT ).
Does anyone know why?
Are there other ways to use the CAST_ functions with not locally defined arrays?
Thank you for the help