Recent

Author Topic: Looking for GetNumaProcessorNode function in Lazarus  (Read 1114 times)

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Looking for GetNumaProcessorNode function in Lazarus
« on: May 23, 2024, 05:54:37 pm »
In what unit this function is declared?
In modern delphi it was in System.SysUtils
 

Fibonacci

  • Sr. Member
  • ****
  • Posts: 453
  • Internal Error Hunter
Re: Looking for GetNumaProcessorNode function in Lazarus
« Reply #1 on: May 23, 2024, 05:55:44 pm »
JwaWindows

Atak_Snajpera

  • New Member
  • *
  • Posts: 31
Re: Looking for GetNumaProcessorNode function in Lazarus
« Reply #2 on: May 23, 2024, 06:03:23 pm »
Do I need both Windows and JwaWindows declared or JwaWindows is an improved version and Windows is depreciate?

Fibonacci

  • Sr. Member
  • ****
  • Posts: 453
  • Internal Error Hunter
Re: Looking for GetNumaProcessorNode function in Lazarus
« Reply #3 on: May 23, 2024, 06:12:46 pm »
If anything, JwaWindows is deprecated, but no, you can use both or just one, as you need

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Looking for GetNumaProcessorNode function in Lazarus
« Reply #4 on: May 23, 2024, 06:17:31 pm »
You can not compare an egg with another egg, both try to do the same, offering Windows API bindings/headers/wrappers, both are imperfect, one is developed by the FreePascal team and the other by project JEDI.
I would always recommend to watch on the MSDN pages or have SDK from the Windows Version you develop for to "fix/update" incorrect/missing things.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

440bx

  • Hero Member
  • *****
  • Posts: 4320
Re: Looking for GetNumaProcessorNode function in Lazarus
« Reply #5 on: May 23, 2024, 07:22:59 pm »
Do I need both Windows and JwaWindows declared or JwaWindows is an improved version and Windows is depreciate?
Here is a suggestion for you, one that I have personally followed and, still occasionally follow:

Create your own Windows API unit that uses FPC windows.  You want this because you want to ensure you use the same types (otherwise you can have the compiler report type mismatches on identically named types which makes locating the problem a problem onto itself.)

In your own Windows API unit, you have your own definitions which may augment what is in FPC's windows unit or override things in that unit.  The one thing you have to ensure is that your unit always appears _after_ FPC's windows unit.

or, if you don't mind incurring into a truckload of work, you can create your own full fledged no-holds-barred replacement for FPC's windows and messages units. Aside from it being an enormous amount of work, it's likely limited in its usefulness if you use packages because those use the types from FPC's windows (and messages) and it's very likely those will collide with your own types if you create a full fledged replacement.  This option is only genuinely useful if you always code directly to the Windows API.

I recommend you create an "extension" unit where you add the missing definitions and override definitions that are "deficient"/"questionable"/"defective" (whatever the case may be in your opinion.)

HTH.
« Last Edit: May 23, 2024, 07:25:03 pm by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 15160
  • Censorship about opinions does not belong here.
Re: Looking for GetNumaProcessorNode function in Lazarus
« Reply #6 on: May 23, 2024, 08:42:58 pm »
If it is really a missing function from Windows, then kindly ask @Marcov to fix it.
He does much - if not all - of the maintenance for the Windows unit.

And he usually does that very quickly.

(Then again, check msdn and simply translate it yourself and use it locally: it is not rocket science.)
It is probably something like this, but I am on Linux atm, so not tested:
Code: Pascal  [Select][+][-]
  1. function GetNumaProcessorNode(const Processor:UnicodeChar;
  2.  var NodeNumber:UnicodeChar):Boolean; stdcall; external 'kernel32.dll'
Not tested but should be close.
https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getnumaprocessornode

To Marco: there are a couple of other related ones missing too. See the link.
« Last Edit: May 23, 2024, 09:16:19 pm by Thaddy »
Of course the national anthem of the U.S.A. was written by Jimi Hendrix, didn't you know that?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5581
  • Compiler Developer
Re: Looking for GetNumaProcessorNode function in Lazarus
« Reply #7 on: May 26, 2024, 10:13:55 pm »
If anything, JwaWindows is deprecated, but no, you can use both or just one, as you need
Do I need both Windows and JwaWindows declared or JwaWindows is an improved version and Windows is depreciate?

Neither is deprecated. The Windows unit is the Delphi compatible unit providing the basis used by the RTL (and many other functions and types not used by the RTL itself, but provided in general). The JwaWindows is a unit provided by the Jedi Windows API package and is essentially the equivalent of the Windows.h in C as it includes more or less all other JwaX units.

 

TinyPortal © 2005-2018