Author Topic: Problem for 64bit  (Read 1280 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!  :)

Offline Choels

  • Imaging User
  • *
  • Posts: 1
    • View Profile
Re: Problem for 64bit
« Reply #2 on: 11 September 2018, 13:35:59 »
I might be having this very issue. I'm also on Windows 10 64-bit. How can I make sure this is the same exact issue btw?


  • Guest
Re: Problem for 64bit
« Reply #3 on: 15 October 2018, 10:47:41 »
Sorry for the late reply (I'm not registered on the site and I do not receive an email alert).

Even if you use Windows 64bit, if you compile for example with Lazarus 32bit you can not have this problem.

Unfortunately, the memory violation has unpredictable effects.

- You can try to change the two lines of suspicious code

  If you use Lazarus (32 / 64bit):
   uInt = NativeUInt
   ptr2int = PtrUInt

  If you use Delphi (depends on the version):
   in theory for 64bit if you use "Int64" it's ok
   For ptr2int see my post

- RESTART the computer (in Windows 10, shut down the system should be similar to a hibernation) to "clean" the corrupted memory.
- Build the library (separately if you use it as a package) and the program

If you see differences with your problem you will have confirmation  ;).

Offline Robaggio

  • Imaging User
  • *
  • Posts: 2
    • View Profile
Re: Problem for 64bit
« Reply #4 on: 4 January 2019, 07:55:05 »
Thank you for sharing the information.