#1 2021-07-13 17:25:25

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Problem compiling mormot2 (E2251)

There is a problem compiling 32Bit mORMot2 with Rad Studio 10.4.2

Errror: [dcc32 Fehler] xxxx.pas(196): E2251 Doppeldeutiger überladener Aufruf von 'UTF8ToString'
  System.pas(40375): Verwandte Methode: function UTF8ToString(const RawByteString): string;
  mormot.core.unicode.pas(3896): Verwandte Methode: function Utf8ToString(const UTF8String): string;

actual i put mormot.core.unicode.UTF8ToString( in my code but i have a lot of code with UTF8ToString
Is there a easy solution ?

System.pas is included in any unit or ?


Rad Studio 12.1 Santorini

Offline

#2 2021-07-13 17:26:25

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: Problem compiling mormot2 (E2251)

i testet something:

there was a former Version of mormot.core.unicode.pas without generating the error:


/// convert any UTF-8 encoded String into a generic VCL Text
// - it's prefered to use TLanguageFile.Utf8ToString() in mORMoti18n,
// which will handle full i18n of your application
// - it will work as is with Delphi 2009+ (direct unicode conversion)
// - under older version of Delphi (no unicode), it will use the
// current RTL codepage, as with WideString conversion (but without slow
// WideString usage)
function Utf8ToString(const Text: RawUtf8): string;
  {$ifdef HASINLINE}inline;{$endif}

/// convert any UTF-8 encoded buffer into a generic VCL Text

Rad Studio 12.1 Santorini

Offline

#3 2021-07-13 17:31:45

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: Problem compiling mormot2 (E2251)

as Solution you should not overload the function and instead rename the second Function e.g to Utf8ToStringP

/// convert any UTF-8 encoded String into a generic VCL Text
// - it's prefered to use TLanguageFile.Utf8ToString() in mORMoti18n,
// which will handle full i18n of your application
// - it will work as is with Delphi 2009+ (direct unicode conversion)
// - under older version of Delphi (no unicode), it will use the
// current RTL codepage, as with WideString conversion (but without slow
// WideString usage)
function Utf8ToString(const Text: RawUtf8): string; // itSDS overload;
  {$ifdef HASINLINE}inline;{$endif}

/// convert any UTF-8 encoded String into a generic VCL Text
procedure Utf8ToStringP(const Text: RawUtf8; var result: string); // overload;
  {$ifdef HASINLINE}inline;{$endif}

what do you think

Last edited by itSDS (2021-07-13 17:32:10)


Rad Studio 12.1 Santorini

Offline

#4 2021-07-13 17:36:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: Problem compiling mormot2 (E2251)

Yes, FPC has no trouble with it, and early versions of Delphi.

Please check https://github.com/synopse/mORMot2/comm … e82e257780

Offline

#5 2021-07-13 18:03:01

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 506

Re: Problem compiling mormot2 (E2251)

ty it works smile


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB