ich möchte gerne die getpixel Funktion von JEDI-SDL benutzen. http://jedi-sdl.pascalgamedevelopment.com/html_docs/guidevideo.html#AEN90 Das funktioniert auch einwandfrei unter Win32 und Linux 32Bit. Wenn ich nun aber die Funktion unter Kubuntu 64bit kompilieren möchte, erhalte ich folgende Warnung:
Conversion between ordinals and pointers are not portable
Naja, soweit so gut, immerhin erhalte ich ein Programm, das aber leider nicht funktioniert und abstürzt.
EAccessViolation : Access violation
$0000000000431BE0
$0000000000431A21
$0000000000411D6E
Ich ging mal auf die Suche und habe folgendes festgestellt:
FPC currently uses 32 bits (4 bytes) for integers, whether the machine is a 32-bit or 64-bit machine. This will cause code expecting an integer and a pointer to be the same size to fail as a 64-bit machine uses 64-bit pointers. To allow you to write portable code, the FPC system unit introduces the types PtrInt and PtrUInt which are signed and unsigned integer data types with the same size as a pointer.
So, die fragliche Zeile sieht bei JEDI-SDL so aus:
Code: Alles auswählen
p := Pointer(Uint32(surface_.pixels) + y * surface_.pitch + x * bpp);
(hier kommt zumindest die Warnung, also nehme ich an, dass hier der Wurm drin ist).
Gibt es nun eine Möglichkeit, dass mein 64Bit FPC mir das korrekt übersetzt (type cast o.ä.)? (PtrInt und PtrUInt habe ich schon probiert.)