Italian community of Lazarus and Free Pascal

Programmazione => Generale => Topic aperto da: nomorelogic - Aprile 06, 2012, 01:40:53 pm

Titolo: Error: Illegal type conversion: "LongInt" to "TObject"
Inserito da: nomorelogic - Aprile 06, 2012, 01:40:53 pm
salve a tutti spero possiate aiutarmi

Ho problemi con la compilazione del package multilog (found in http://wiki.lazarus.freepascal.org/MultiLog)

l'errore è:
/usr/lib/lazarus/0.9.28.2/components/multilog-05/multilog.pas(807,29) Error: Illegal type conversion: "LongInt" to "TObject"

Codice: [Seleziona]
procedure TLogger.AddCheckPoint(Classes: TDebugClasses; const CheckName: String);
var
  i,j: Integer;
begin
  if Classes * ActiveClasses = [] then Exit;
  i:=FCheckList.IndexOf(CheckName);
  if i <> -1 then
  begin
    //Add a custom CheckList
    j:=PtrInt(FCheckList.Objects[i])+1;
    FCheckList.Objects[i]:= TObject(j);    <---- error line -------------
  end
  else
  begin
    FCheckList.AddObject(CheckName,TObject(0));
    j:=0;
  end;
  SendStream(ltCheckpoint,CheckName+' #'+IntToStr(j),nil);
end;


non capisco, sembra un semplice cast
qualche idea?

grazie


PS:
postato anche in
http://forum.lazarus.freepascal.org/index.php?action=post;msg=90099;topic=16552.0
Titolo: Re:Error: Illegal type conversion: "LongInt" to "TObject"
Inserito da: nomorelogic - Aprile 06, 2012, 04:34:12 pm
mi hanno risposto sul forum ufficiale
dipende dal fatto che compilo per 64 bit
la linea di codice va sostiuita con la seguente

Codice: [Seleziona]
FCheckList.Objects[i]:= TObject(PtrUint(j));
Titolo: Re:Error: Illegal type conversion: "LongInt" to "TObject"
Inserito da: xinyiman - Aprile 07, 2012, 02:20:53 pm
Bene sono contento che hai risolto e grazie per aver condiviso l'informazione.
Titolo: Re:Error: Illegal type conversion: "LongInt" to "TObject"
Inserito da: nomorelogic - Aprile 07, 2012, 06:35:35 pm
mi pare il minimo ;)