Hi, another nim newbie here. I was looking for a way to show the available system memory for Windows OS. My research took me as far as the psutils package, and then I started sobbing when I read "Linux only". Is there anything else I can use, like a way to query windows counters with nim. If so, thanks in advance to anyone who can point me there.
P.S. Is this a suitable tutorial type link http://codeninja.blog/2019/exploring-nim/
I'm not aware of any packages that do this, but you can write your own.
The WinAPI is fairly straightforward to use once you get the hang of it, I and many others I'm sure are happy to help as well. This is likely what you want: https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-globalmemorystatusex. Just have to wrap it in Nim and call it :)
You need to install winim package first, ">nimble install winim" for this
strformat,winim/lean
var
memStatus : MEMORYSTATUSEX
memstatus.dwLength = cast[DWORD](sizeof(MEMORYSTATUSEX))
if (GlobalMemoryStatusEx(memStatus.addr) != 0):
echo(fmt"Total: {$memStatus.ullTotalPhys} Available: {$memStatus.ullAvailPhys}")