Google Groups

Calling kernel.dll from Mathematica


Alexey Popkov Mar 16, 2010 2:47 AM
Posted in group: comp.soft-sys.math.mathematica
Hello,
There are nice examples in the Documentstion on calling simple functions
defined in the Windows's kernel.dll from Mathematica. For example, it is
easy to call GetTickCount function:

Needs["NETLink`"]
getTickCount = DefineDLLFunction["GetTickCount", "kernel32.dll", "int", {}]

But I have not found any example on calling a function that returns a
structure. I am interested in use GlobalMemoryStatusEx function that
"retrieves information about the system's current usage of both physical and
virtual memory." In C# it is easy to get this information in numerical form:

http://msdn.microsoft.com/en-us/library/aa366589%28VS.85%29.aspx

But how can this be done in Mathematica?