[fpc-devel] bug report 20473: Please add a directive to define string=utf8string

Marco van de Voort marcov at stack.nl
Thu Oct 13 10:47:27 CEST 2011


In our previous episode, Felipe Monteiro de Carvalho said:
> I dont fully understand your question, but lets suppose this RTL file:
> 
> unit system;
> {$mode string = banana}
> type RTLString = string;
> 
> unit classes;
> {$mode string = banana}
> type
>   TWhaeverClass = class
>   procedure Do(Param: string); virtual;
>   end;
> 
> unit mylazarusunit;
> {$mode string = utf8string}
> type
>   TWhaeverClassOverride = class(TWhaeverClass)
>   procedure Do(Param: RTLString); override;
>   end;
> 
> I think that this would work,  because the signatures of the
> procedures match perfectly.

I think so, but I haven't tried.

But I don't consider this as solution. You have to put each string type in
the entire libraries on trial, and keep it up.

Moreover, it gets funky when string is banana on Windows and banana2 on
unix. It keeps working, but if people make mistakes that "happen" to work on
one platform, the other people might have a problem etc.

Also, dual maintenance of components with Delphi is next to impossible,
since you would force that scheme also onto them, and all new code first
needs to be lazarused.




More information about the fpc-devel mailing list