Windows PSAPI

Sergey Gromov snake.scaly at gmail.com
Mon Sep 8 02:29:06 PDT 2008


torhu <no at spam.invalid> wrote:
> Sergey Gromov wrote:
> > The call to GetModuleFileNameExA() messes up stack.  As far as I can 
> > tell this happens because PSAPI functions are declared extern(C) in 
> > psapi.d bindings, but in fact are __stdcall.  The problem is, it's not 
> > possible to replace extern(C) with extern(Windows) because the psapi.dll 
> > functions have unmangled names, while extern(Windows) mangles them with 
> > argument stack size.  I don't have a slightest idea of how to specify 
> > mangling convention and calling convention separately in D. In C 
> > declaration looks like:
> 
> Using coffimplib with a psapi.lib taken from the M$ platform SDK will 
> probably work.  The stdcall mangling is present in the .lib file, but 
> not the .dll.  I didn't test the resulting OMF lib file, but the names 
> are correctly mangled, "_GetModuleFileNameExA at 16" and so on.
> 
> http://ftp.digitalmars.com/coffimplib.zip

Thank you, this is another fine tool that works.


More information about the Digitalmars-d-learn mailing list