[fpc-devel] Unicode RTL for FPC

Michael Van Canneyt michael at freepascal.org
Fri Jan 6 18:05:43 CET 2023


I'm currently working for a company (Tixeo.com) that is preparing to use FPC to
recompile their flagship product (written in Delphi) for certain targets.

As part of this work, we're striving to make the Free Pascal 
RTL and Packages more compatible with recent Delphis.

That means:

- String = UnicodeString, Char=WideChar
- Dotted units.

Before you all get a heart attack:

Because backwards compatibility is important, FPC will of course 
continue to distribute a backwards-compatible RTL and packages, 
with single-byte string. All FPC modes will continue to function.

To make this possible a feature called 'subtargets' has been implemented.
This can be used for other things than the unicode RTL, but will be used for
the unicode RTL.

The RTL is compiled 'normally' and with subtarget=unicodertl; 
this will result in 2 separate sets of .o/.ppu files:

The normal CPU-OS directory and a CPU-OS-unicodertl directory.

The first part of the work has been pushed to gitlab in a branch called
unicodertl (NOT the svn/unicodertl branch):

- subtarget support is there
- The rtl compiles with make SUB_TARGET=unicodertl with the compiler as it
   is in that branch.

Needless to say, this is a major change that will need thorough testing.

The earlier testing starts, the better.

For those that wish to help in testing:

- Update your git clone

- switch to branch unicodertl.

- in the toplevel FPC directory, do a

make all

- if that went well, next to your fpc.cfg, create a file fpc-unicodertl.cfg  with the following contents:


- to create a Unicode RTL, in the rtl directory do a

make clean all SUB_TARGET=unicodertl PP=path/to/the/new/compiler

- if that worked, you can try then a

make install SUB_TARGET=unicodertl

Note that this is NOT ready for production use:

- The packages have not yet been converted (working on this now) and will
   certainly fail...
- a private testsuite has been run and gives no failures, but the complete compiler testsuite still needs to be examined.
- Dotted names will be created after the unicode transition is deemed complete.

if you do wish to test and spot errors in the RTL or compiler, please file a bugreport.

You can use a tag 'UnicodeRTL' to report bugs for this.


More information about the fpc-devel mailing list