Windows API: Strange behaviour after calling GetModuleFileNameExA
Carlos Santander
csantander619 at gmail.com
Wed Nov 28 07:06:53 PST 2007
Tobias Wassermann escribió:
> The problem is:
>
> EnumProcesses() and GetModuleFileNameExA() both are marked as extern "C"
> within the psapi.h - the difference is: EnumProcesses works and
> GetModuleFileNameExA() in D and with DMC seems to corrupt the stack. If I
> move the C-ported code to the Microsoft Visual C++ and compile it, it works
> fine.
>
> On the other side: extern (C) within D is the only possibility to use for
> this two functions, if I use extern (Windows) I'll get linker errors (linker
> can not find symbols _EnumProcesses at 12 and _GetModuleFileNameExA at 16).
>
> With extern (Windows) it seems to be correct - remember: EnumProcesses()
> works fine, only GetModuleFileNameExA() causes the problem.
>
> Additional note: GetProcessImageFileNameA() (which could be an alternative to
> GetModuleFileNameExA()) causes the same problem.
>
You could use a .def file to alias _EnumProcesses at 12 to EnumProcesses.
--
Carlos Santander Bernal
More information about the Digitalmars-d
mailing list