Welcome to Web-News
A Web-based News Reader
Subject Re: Windows PSAPI
From torhu <no@spam.invalid>
Date Sun, 07 Sep 2008 22:41:32 +0200
Newsgroups digitalmars.D.learn

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@16" and so on.

http://ftp.digitalmars.com/coffimplib.zip

Recent messages in this thread
 
-# Windows PSAPI sleek 06-Sep-2008 11:16 am
.-# Re: Windows PSAPI Sergey Gromov 07-Sep-2008 12:20 pm
..-# Re: Windows PSAPI sleek 07-Sep-2008 02:15 pm
..|-# Re: Windows PSAPI - 3 files [1/1] Sergey Gromov 07-Sep-2008 02:50 pm
..|.-# Re: Windows PSAPI - 3 files [1/1] wyverex 07-Sep-2008 03:04 pm
..|.||# Re: Windows PSAPI - 3 files [1/1] sleek 07-Sep-2008 03:15 pm
..|.|\# Re: Windows PSAPI - 3 files [1/1] Sergey Gromov 07-Sep-2008 03:20 pm
..|.\# Re: Windows PSAPI - 3 files [1/1] sleek 07-Sep-2008 03:10 pm
..-# Re: Windows PSAPI (Current message) torhu 07-Sep-2008 04:41 pm
...\# Re: Windows PSAPI Sergey Gromov 08-Sep-2008 05:29 am