How to call Windows function pointers?

Benji Smith dlanguage at benjismith.net
Sat Aug 16 14:03:15 PDT 2008


downs wrote:
>> Try this (untested):
>>
>> template ExtWinType(T) { extern(Windows) alias T ExtWinType; }
>>
>> void callWin32Fn() { auto lib ...; auto fn = cast(ExtWinType!(BOOL function(MEMORYSTATUSEX))) lib.getSymbol("..."); fn(foo); }
> 
> If it doesn't work, try typedef instead.

The template (with either the alias or the typedef) compiles just fine, 
but still results in a runtime Access Violation.

--benji


More information about the Digitalmars-d-learn mailing list