Recent

Author Topic: Question regarding ToolHelp32  (Read 1268 times)

440bx

  • Hero Member
  • *****
  • Posts: 1086
Question regarding ToolHelp32
« on: February 14, 2019, 11:53:03 pm »
Hello,

While porting Delphi v2.0 code, FPC complains that TLHelp32 is not found.

To be certain, I searched the libraries included with Lazarus and only found TLHelp32 for WinCE.  I also found a TLHelp32 translation from the Jedi group but, the unit name is different (prefixed jwa.)

I just wanted to make sure that there is no TLHelp32 unit for desktop Windows that I may have missed.  Is this really the case ?

Thank you for your help.
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 1986
Re: Question regarding ToolHelp32
« Reply #1 on: February 15, 2019, 12:31:51 am »
I just wanted to make sure that there is no TLHelp32 unit for desktop Windows that I may have missed.  Is this really the case ?

Yes, there are no others than the WinCE and the JEDI ones:

Code: Bash  [Select]
  1. lucamar@selene:~/SoftDev/z/FPC source/3.0.4$ fgrep -iRl "CreateToolhelp32" *
  2. packages/winunits-jedi/src/jwatlhelp32.pas
  3. packages/winceunits/src/tlhelp32.pas
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 1086
Re: Question regarding ToolHelp32
« Reply #2 on: February 15, 2019, 12:44:08 am »
Yes, there are no others than the WinCE and the JEDI ones:

Code: Bash  [Select]
  1. lucamar@selene:~/SoftDev/z/FPC source/3.0.4$ fgrep -iRl "CreateToolhelp32" *
  2. packages/winunits-jedi/src/jwatlhelp32.pas
  3. packages/winceunits/src/tlhelp32.pas

Thank you Lucamar.  I suspected that but, I wanted confirmation I had not missed it.
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 571
  • Compiler Developer
Re: Question regarding ToolHelp32
« Reply #3 on: February 15, 2019, 09:03:37 am »
Just using the Jedi unit should be enough. It's only an API import anyway (though there could be differences with pointer parameters (regarding var vs. no var), don't know what the Delphi unit used there in comparison to the Jedi one).

440bx

  • Hero Member
  • *****
  • Posts: 1086
Re: Question regarding ToolHelp32
« Reply #4 on: February 15, 2019, 12:05:48 pm »
Just using the Jedi unit should be enough. It's only an API import anyway (though there could be differences with pointer parameters (regarding var vs. no var), don't know what the Delphi unit used there in comparison to the Jedi one).
Yes, the Jedi unit would do fine.  My goal is to make Delphi 2 code compile with FPC in both 32bit and 64bit code with a _minimum_ of changes in the code.  Since Delphi has a TLHelp32 unit, I simply made a new TLHelp32 that works in 32bit, 64bit, Delphi and FPC.

using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.