Thanks for the tip, it turns out there is a slight quirk, almost a bug, where if you define a type like
TYPE REAL64 = LONGREAL
then try to do the cast to a REAL64 it won't work... it only allows raw casting to low level primitive types, not an alias to the same type... I don't know why i liked the name REAL64 better than longreal, but hey that is easy to fix!
now if only i could get a clean ISO library for RealtoStr that doesn't introduce rounding errors, i should be all set.