Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-12

1.2RC1, Incompatible type and overload

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Frederic Da Vitoria

Hello,

I posted this on the forum, but maybe the forum is not the best place, so I post it here too.

I have an "Incompatible type" error which I can't figure out

program DominoMo;
{$MODE Delphi}

uses
Globals in 'GLOBALS.PAS',

  Parametr in 'PARAMETR.PAS';
begin
end.
unit GLOBALS ;
{$MODE Delphi}
interface
  uses Laz2_Dom, Laz_XmlRead, Laz_XmlWrite ;
  const XML_FILE_NAME = 'DominoMot.xml' ;
  var XmlWordLists : TXmlDocument ;
implementation
initialization
  {16} ReadXmlFile (XmlWordLists, XML_FILE_NAME)
end.
unit PARAMETR ;
{$MODE Delphi}
interface
uses SysUtils, XmlWrite, GLOBALS;
implementation
  procedure InitAndShowModal ;
  begin
    {13} //WriteXmlFile (XmlWordLists, ChangeFileExt (ParamStr (0), '.xml'))
  end ;
end.

Using Lazarus 1.2RC1, I get: PARAMETR.PAS(13,69) Error: Incompatible type for arg no. 2: Got "AnsiString", expected "TStream" If I comment out line 16, the project compiles OK. If I put my cursor on ReadXmlFile and press Alt+Up, the editor jumps to the correct overloaded version
If I put my cursor on WriteXmlFile and press Alt+Up, the editor skips the string version and jumps to the stream version

Using Lazarus 1.0.14, I get: GLOBALS.PAS(16,43) Error: Incompatible type for arg no. 2: Got "Constant String", expected "TStream" If I comment out line 16, the compiler stops on the same error as for 1.2RC1 If I put my cursor on ReadXmlFile and press Alt+Up, the editor skips the string version and jumps to the stream version
If I put my cursor on WriteXmlFile and press Alt+Up, the editor skips the string version and jumps to the stream version

I can't figure any of those errors:
None should occur as far as I can see, as ReadXMLFile and WriteXMLFile both have overloaded versions which take an ansistring for second parameter.

Is this a bug or am I missing something?

Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131206/f71bad36/attachment.html>

Reply by email

Frederic Da Vitoria
to Mattias Gaertner

2013/12/6 Mattias Gaertner

Show quoted text 12 lines
On Fri, 6 Dec 2013 11:26:12 +0100 Frederic Da Vitoria wrote: >[...] > uses Laz2_Dom, Laz_XmlRead, Laz_XmlWrite ; Do not mix version 1 and 2. uses Laz2_Dom, Laz2_XmlRead, Laz2_XmlWrite ; Mattias

Ah! This makes more sense :-) Yes, this is the solution. Thanks.

Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131206/278724b4/attachment.html>

Reply by email

Torsten Bonde Christiansen
to Mattias Gaertner: On Fri, 6 Dec 2013 11:26:12 +0100 Do not mix version 1 and 2. uses Laz2_Dom,…
Mattias Gaertner wrote 8 lines
On Fri, 6 Dec 2013 11:26:12 +0100 Frederic Da Vitoria wrote: > [...] > uses Laz2_Dom, Laz_XmlRead, Laz_XmlWrite ; Do not mix version 1 and 2. uses Laz2_Dom, Laz2_XmlRead, Laz2_XmlWrite ;

I hope this isn't too dumb a quiestion, but what are the differences between the Laz2_{Dom,XMLRead...} and the fcl (DOM, XMLRead) equivalent units?

Regards,
Torsten.

Reply by email

Mattias Gaertner
to Torsten Bonde Christiansen
Show quoted text 13 lines
On 2013-12-06 11:38, Mattias Gaertner wrote: > On Fri, 6 Dec 2013 11:26:12 +0100 > Frederic Da Vitoria wrote: > >> [...] >> uses Laz2_Dom, Laz_XmlRead, Laz_XmlWrite ; > Do not mix version 1 and 2. > > uses Laz2_Dom, Laz2_XmlRead, Laz2_XmlWrite ; I hope this isn't too dumb a quiestion, but what are the differences between the Laz2_{Dom,XMLRead...} and the fcl (DOM, XMLRead) equivalent units?

Laz2 uses UTF8, the FCL uses widestring.
The Laz2 has some flags to keep whitespaces.

Mattias

Reply by email