During the recent FPC hackathon, Michael van Canneyt and I created a branch to switch some RTL routines to unicode. (to be exact, rawbytestring and unicodestring versions). This scheme is compatible with all dynamic string types as long as the encoding is properly set. Be careful with pointers (pchar), since they don't have encoding.
It is still all very simple, but people wanting to explore the 2-byte Windows API can find it in FPC svn fpc/branches/unicode.
However, and this is the main reason of this post, that branch also changes the windows unit to 2-byte "W" mode on Windows. Some Winunits-base units will also flip.
I tried to compile Lazarus with it, but that fails because Lazarus uses "general" functions (no -A and -W) but passes them p(ansi)char. IOW when the default changes to -W this breaks on errors like:
graphic.inc(155,66) Error: Incompatible type for arg no. 3: Got "PChar",
expected "PWideChar"since the units are compiled in objfpc mode, and not in mode delphiunicode
Probably for now, it is best to change those issues all by appending a -A.
To build a 2-byte windows unit (and the new RTL),
1) checkout fpc/branches/unicode
2) do a make cycle to get a fresh 2.7.1
3) compile the snapshot (make all in toplevel) with -dFPC_UNICODE_RTL and FPC_OS_UNICODE (and OVERRIDEVERSIONCHECK=1 obviously)
4) compile Lazarus with the resulting snapshot.
Patches to improve 2-byte compatibility of the windows unit are welcome too.
