Sign in Join

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

Mailing lists / lazarus / 2012-09

overloaded proc not found

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Marc Santhoff

Hi,

is there any problem with overloading in fpc2.6.0? Or another change making lazarus behave like this:

<snip>

// ncore.pas
TnkDOMTree = class( TXMLDocument )
public
...
end;
function LoadTnkTreeTreeFromXMLFile(fname: string): TnkDOMTree;
var
  t: TnkDOMTree;
begin
  t := NIL; { avoid warning }
  try
    XMLRead.ReadXMLFile(t, fname); // <-- line 82, errror spot
  except
    on e: exception do begin
      FreeAndNil(t);
    end;
  end;
  result := t;
end;
// XMLRead.pas, from line 44:
procedure ReadXMLFile(out ADoc: TXMLDocument; const AFilename: String); overload;
procedure ReadXMLFile(out ADoc: TXMLDocument; var f: Text); overload;
procedure ReadXMLFile(out ADoc: TXMLDocument; f: TStream); overload;
procedure ReadXMLFile(out ADoc: TXMLDocument; f: TStream; const ABaseURI: String); overload;

</snip>

Compiler says on "build all":

ncore.pp(82,33) Error: Incompatible type for arg no. 2: Got "AnsiString", expected "TStream"

Compiler is:
$ fpc -i
Free Pascal Compiler version 2.6.0

Compiler Date : 2011/12/30
Compiler CPU Target: x86_64
...

I did not change anything in the source, but the machine is now on 64 bit OS and was 32 bit. And I updated lazarus (from 2012-07-05, SVN 35971). Those lines compiled and ran fine, and I think they should do now, too. I've tried deleting all .o and .ppu of the program, no change.

TIA,
Marc

Marc Santhoff

Reply by email

Mattias Gaertner
to Marc Santhoff

Marc Santhoff hat am 5. September 2012 um 09:56 geschrieben:

Show quoted text 13 lines
Hi, is there any problem with overloading in fpc2.6.0? Or another change making lazarus behave like this: TnkDOMTree = class( TXMLDocument ) procedure ReadXMLFile(out ADoc: TXMLDocument; const AFilename: String); overload; procedure ReadXMLFile(out ADoc: TXMLDocument; var f: Text); overload; procedure ReadXMLFile(out ADoc: TXMLDocument; f: TStream); overload; procedure ReadXMLFile(out ADoc: TXMLDocument; f: TStream; const ABaseURI: String); overload;

out parameters must match exactly.
Older fpc had a bug and didn't spot it.

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120905/b06e38d4/attachment.html>

Reply by email

Marc Santhoff
to Mattias Gaertner
Mattias Gaertner wrote 17 lines
Marc Santhoff hat am 5. September 2012 um 09:56 geschrieben: > Hi, > > is there any problem with overloading in fpc2.6.0? Or another change > making lazarus behave like this: > TnkDOMTree = class( TXMLDocument ) > procedure ReadXMLFile(out ADoc: TXMLDocument; const AFilename: String); > overload; > procedure ReadXMLFile(out ADoc: TXMLDocument; var f: Text); overload; > procedure ReadXMLFile(out ADoc: TXMLDocument; f: TStream); overload; > procedure ReadXMLFile(out ADoc: TXMLDocument; f: TStream; const ABaseURI: > String); overload; out parameters must match exactly. Older fpc had a bug and didn't spot it.

That did it!

Beutiful, making progress is a nice thing. :)

Thanks a lot,
Marc

Marc Santhoff

Reply by email