Author Topic: Problem for 64bit  (Read 253 times)


  • Guest
Problem for 64bit
« on: 17 February 2018, 14:27:48 »

I found a problem using the latest version of lazarus (1.8.0 64bit FPC 3.0.4) in debug mode. On Windows 10 64bit.

In the imjmorecfg.pas file I saw:

Code: Delphi
  1. uInt = Cardinal;

This I think is a problem for 64bit systems

For FPC if I replace with
uInt = NativeUInt
I do not perform more dangerous crashes

Also I think there is a similar problem (I have not tested) for:

uInt = cardinal; -> NativeUInt
ptr2int = uInt; -> PtrUInt
(but the message "Nomssi" under "ptr2int" is not very clear)

I noticed that through the lazarus compiler, several "warning" and "hint" messages appear.
For "justified Hints" it is possible to disable them (to avoid having to run many already verified messages).

Code: Delphi
  1. FillChar(TmpInfo, SizeOf(TmpInfo), 0);
show variable message not initialized
it is due to the use of "var" but here it is correct then
Code: Delphi
  1. FillChar({%H-}TmpInfo, SizeOf(TmpInfo), 0);
avoid the message (it is filtered by lazarus itself)

Finally, the compilation on the ImagingPcx.pas unit is blocked
Code: Delphi
  1. ifMono: TImageFormat = TImageFormat (250);
I do not know if it's correct.
I know that the SizeOf () dimension of the "enum" types can change depending on the number of elements.
The compiler writes:
ImagingPcx.pas(91,43) Error: range check error while evaluating constants (250 must be between 0 and 206)

(sorry for my English)



  • Guest
Re: Problem for 64bit
« Reply #1 on: 27 June 2018, 19:11:55 »
The crash I found is a memory violation (unfortunately, too much time has passed and I do not remember what happened. The original source has been heavily modified. Probably there was an anomaly in the program or a violation message of memory by the debugger). The application is very large and also uses several third-party libraries. I isolated the problem by excluding source parts. Finally, by applying the change reported, I no longer detected problems with memory.
So providing a source that can show a problem like this is very difficult  :(.

But these resources should help:



32bit / 64 bit support

Pointers under 64bit need 8 bytes instead of 4 on 32bit. The 'Integer' type remains for compatibility 32bit. This means you can no longer typecast pointers into integers and back. FPC defines two new types: PtrInt and PtrUInt. PtrInt is a 32bit signed integer on 32 bit platforms and a 64bit signed integer on 64bit platforms. The same for PtrUInt, but unsigned integer instead. Use for code that should work with Delphi and FPC:

{$IFNDEF FPC} for 32bit
  PtrInt = Longint;
  PtrUInt = DWord;

{$IFNDEF FPC} for 64bit
  PtrInt = Int64;
  PtrUInt = QWord;


NOTE: pointers are unsigned integer

 Thank!  :)