AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Delphi 12 / TList unter 64 Bit funktioniert nicht mehr wie unter 11.3
Thema durchsuchen
Ansicht
Themen-Optionen

Delphi 12 / TList unter 64 Bit funktioniert nicht mehr wie unter 11.3

Ein Thema von swestner · begonnen am 10. Nov 2023 · letzter Beitrag vom 10. Nov 2023
Antwort Antwort
swestner

Registriert seit: 31. Aug 2012
Ort: Hallstadt
74 Beiträge
 
Delphi 10.4 Sydney
 
#1

Delphi 12 / TList unter 64 Bit funktioniert nicht mehr wie unter 11.3

  Alt 10. Nov 2023, 13:06
Delphi-Version: 11 Alexandria
Hallo,

folgender Code hat mit Delphi 11.3 unter 32 und 64 Bit problemlos compiliert. Mit Delphi 12 32 Bit funktioniert es weiterhin, mit Delphi 12 64 Bit gibt es Fehler:

Delphi-Quellcode:
type TSupBookList = class(TList)
private
     function GetItems(Index: integer): TSupBook;
public
     destructor Destroy; override;
     procedure Clear; override;
     procedure Add(P: PRecSUPBOOK); overload;
     procedure Add(Path,Filename,SheetName: AxUCString); overload;
     function AddEncodec(Tabs: integer; Code: word): integer;
     property Items[Index: integer]: TSupBook read GetItems; default;
end;

type TExternalNames = class(TObject)
private
     FSupBooks: TSupBookList;
public
     procedure SetCRN (SheetIndex: integer; P: PRecCRN; Size: word);
end;

procedure TExternalNames.SetCRN(SheetIndex: integer; P: PRecCRN; Size: word);
begin
  if FSupBooks.Count <= 0 then
    raise XLSRWException.Create('No SUPBOOK for CRN');
  if SheetIndex >= FSupBooks[FSupBooks.Count - 1].Count then // <----E2018 Record, object or class type required
    raise XLSRWException.Create('Invalid SUPBOOK Sheet Index');
  FSupBooks[FSupBooks.Count - 1].Sheets[SheetIndex].SetCRN(P,Size); // <----E2018 Record, object or class type required
end;
Wo ist da jetzt das Problem? Zumal alles mit 11.3 funktioniert hat.

Wurde in 12 was an TList geändert?

Grüße

Stefan Westner
Stefan Westner

Geändert von TBx (10. Nov 2023 um 16:35 Uhr) Grund: Delphi-Tags eingefügt
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.014 Beiträge
 
Delphi 12 Athens
 
#2

AW: Delphi 12 / TList unter 64 Bit funktioniert nicht mehr wie unter 11.3

  Alt 10. Nov 2023, 13:12
Wurde in 12 was a TList geändert?
Index und Count sind jetzt NativeInt , was unter 64-Bit nicht mehr gleich Integer ist. Damit löst FSupBooks[FSupBooks.Count - 1] auf das NativeInt Items Property von TList auf und nicht auf deine Integer Version.
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
swestner

Registriert seit: 31. Aug 2012
Ort: Hallstadt
74 Beiträge
 
Delphi 10.4 Sydney
 
#3

AW: Delphi 12 / TList unter 64 Bit funktioniert nicht mehr wie unter 11.3

  Alt 10. Nov 2023, 14:30
Heißt das jetzt, daß ich überall machen muß:

Delphi-Quellcode:
{$IFDEF WIN32}
property Items[Index: integer]: TSupBook read GetItems; default;
{$ELSEIF WIN64}
property Items[Index: NativeInt]: TSupBook read GetItems; default;
{$ENDIF}
Oder kann pauschal immer

property Items[Index: NativeInt]: TSupBook read GetItems; default;
verwendet werden?
Stefan Westner

Geändert von TBx (10. Nov 2023 um 16:39 Uhr) Grund: Delphi-Tags eingefügt
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.149 Beiträge
 
Delphi 12 Athens
 
#4

AW: Delphi 12 / TList unter 64 Bit funktioniert nicht mehr wie unter 11.3

  Alt 10. Nov 2023, 14:47
NativeInt ist unter 32 Bit 32 Bit groß und unter 64 Bit natürlich 64 Bit.

im Grunde genommen sieht es quasi so aus
Delphi-Quellcode:
type
  {$IFDEF WIN32}
  NativeInt = Integer; // aka Int32
  {$ELSE}
  NativeInt = Int64;
  {$ENDIF}
https://quality.embarcadero.com/browse/RSP-20886
https://quality.embarcadero.com/browse/RSP-42722
https://www.facebook.com/embarcadero...h7JYZD1KTBhKKl

Es gab aber im QP auch einen eigenen BugReport bezüglich dieses Problems (fand ihn nicht, aber siehe Facebook),
also dass der Typ "NativeInt" nun strenger geprüft wird
und unter Win64 dann plötzlich Int64 und NativeInt nicht "identisch" sind, obwohl sie eigentlich gleich sind.
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests

Geändert von himitsu (10. Nov 2023 um 14:52 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.014 Beiträge
 
Delphi 12 Athens
 
#5

AW: Delphi 12 / TList unter 64 Bit funktioniert nicht mehr wie unter 11.3

  Alt 10. Nov 2023, 14:50
Oder kann pauschal immer

property Items[Index: NativeInt]: TSupBook read GetItems; default;

verwendet werden?
Genau so ist das gedacht.
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:12 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz