[fpc-devel] WideString vs UnicodeString / len in char vs byte / *nix vs windows
fpc at mfriebe.de
Thu Apr 25 15:41:53 CEST 2019
Looking at https://bugs.freepascal.org/view.php?id=35359
and the latest comments (see end of mail)
Is it correct, that "widestring" here has 2 meanings?
- the "widestring" that has length in bytes (windows bstr)
- "widestring" as a typename / alias
And apparently then on *nix, "widestring" is just an alias (to
So using the type with the name of "widestring" on *nix will compile to
a type that has length in chars?
At least my test app, seems to imply this.
> Is the len on widestring always in bytes?
> This prints the dwords in front of each string.
> On Windows, it indeed prints 10 for a widestring of len 5.
> But on linux, it prints 5 for all the strings.
> Tested 64 bit.
^^ test source with wide and uni string of len 5, and memory dump of
> Anyway the patch seems to work for linux too (only tested 64 bit)
> widestring seems to be an alias for unicodestring in this case.
> Yes, the length field for WideString is specified in bytes.
> For compatible with Delphi
> and Windows BSTR type
More information about the fpc-devel