Windows API: Strange behaviour after calling GetModuleFileNameExA
Regan Heath
regan at netmail.co.nz
Tue Nov 27 08:14:28 PST 2007
Joel Lucsy wrote:
> Tobias Wassermann wrote:
>> extern (Windows) HANDLE OpenProcess(uint dwDesiredAccess, BOOL
>> bInheritHandle, uint dwProcessId); extern (C) {
>> BOOL EnumProcesses(DWORD* pProcessIds, DWORD cb, DWORD*
>> pBytesReturned);
>> DWORD GetModuleFileNameExA(HANDLE hProcess, HMODULE hModule, char*
>> fileName, uint size); }
>
> Ah, I would tend to think that EnumProcesses and GetModuleFileNameExA
> should be extern(Windows) as well. All Win32 api's use STDCALL, which is
> what I believe extern(Windows) sets.
I thought the same thing but couldn't get it to link with
extern(Windows) on those two.
I've just looked at the psapi.h header in my SDK I see:
#ifdef __cplusplus
extern "C" {
#endif
BOOL
WINAPI
EnumProcesses(
DWORD * lpidProcess,
DWORD cb,
DWORD * cbNeeded
);
note the extern "C" there. I believe that confirms it's C linkage and
not Windows linkage.
Thanks for the suggestion though :)
It seems the same problem occurs when Tobias calls the routines from C
which suggests a problem with the implib used to convert the dll into a
library.
Regan
More information about the Digitalmars-d
mailing list