Recent

Author Topic: Strange Error  (Read 4649 times)

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Strange Error
« on: January 22, 2017, 04:04:09 pm »
hi!
im porting the toro kernel system.pas from 2.6.4 to 3.0.0 and i'm getting some  weird compile errors

1/
system.pas(410,11) Error: overloaded identifier "SetString" isn't a function

the function declaration is the following:

Procedure SetString (Var S : Shortstring; Buf : PChar; Len : SizeInt);
2/
SetLength(DestS,Size+Location);  --> system.pas(4850,7) Error: Wrong number of parameters specified for call to "fpc_AnsiStr_SetLength"
and the info on the net on this error is very vague


i guess its some changes in string handling and internal fpc procedures but i cannot figure what exactly is happeninf between fpc versions

help welcomed





Speak postscript or die!
Translate to pdf and live!

lainz

  • Hero Member
  • *****
  • Posts: 4463
    • https://lainz.github.io/
Re: Strange Error
« Reply #1 on: January 22, 2017, 04:40:31 pm »
1) Seems that there's a function not a procedure already called SetString
2) What is DestS?

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: Strange Error
« Reply #2 on: January 22, 2017, 05:54:52 pm »
1/ no it's not that ... i cannot find any procedure/function with the same name that cannot be overloaded.
2/ SetLength is the standart internal fpc function but for some reason the compiler sees a wrong number of parameters

Speak postscript or die!
Translate to pdf and live!

lainz

  • Hero Member
  • *****
  • Posts: 4463
    • https://lainz.github.io/
Re: Strange Error
« Reply #3 on: January 22, 2017, 06:19:27 pm »
1) Can you give some more code, we can't see all your function declarations magically  ::)
2) I mean wich type is DestS

Maybe in both cases is a problem of wich type is declared in the variable or procedure declaration. But I can't say since I don't know exactly the changes that was made to the compiler.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: Strange Error
« Reply #4 on: January 22, 2017, 07:47:14 pm »
here is the code :)
https://github.com/MatiasVara/torokernel/blob/master/rtl/system.pas

its working perfectly but in 2.6.4... something changed in internal/compilerprocs  beetween versions
Speak postscript or die!
Translate to pdf and live!

bytebites

  • Hero Member
  • *****
  • Posts: 633
Re: Strange Error
« Reply #5 on: January 22, 2017, 08:11:53 pm »
It has changed to intrinsic procedure. Same fate happened to Insert- and Delete- functions in trunk-version.

lainz

  • Hero Member
  • *****
  • Posts: 4463
    • https://lainz.github.io/
Re: Strange Error
« Reply #6 on: January 22, 2017, 08:12:11 pm »
your SetLength error is here:

Code: Pascal  [Select][+][-]
  1. procedure fpc_AnsiStr_Concat (var DestS:ansistring;const S1,S2 : AnsiString); compilerproc;

in compproc.inc in FPC 3.0 we have

Code: Pascal  [Select][+][-]
  1. Procedure fpc_AnsiStr_Concat (Var DestS : RawByteString;const S1,S2 : RawByteString{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;

and this has a third parameter:

Code: Pascal  [Select][+][-]
  1. Procedure fpc_AnsiStr_SetLength (Var S : RawByteString; l : SizeInt{$ifdef FPC_HAS_CPSTRING};cp : TSystemCodePage{$endif FPC_HAS_CPSTRING}); compilerproc;

So Ansistring was replaced with RawByteString.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: Strange Error
« Reply #7 on: January 22, 2017, 08:17:53 pm »
ok thanks !!! great! now i have to figure out how to deal with new @$#&&! codepaged strings  of fpc >:D >:D
Speak postscript or die!
Translate to pdf and live!

 

TinyPortal © 2005-2018