digitalmars.D - Symbol Undefined _EnumWindows 12
- AntonSotov (23/23) Jan 23 2014 hello.
- Daniel Murphy (5/6) Jan 23 2014 The second argument is LPARAM, which maps to C's long, but D's long maps...
- AntonSotov (1/1) Jan 24 2014 all thank you very much! realized my mistake.
- Adam D. Ruppe (5/7) Jan 23 2014 These shouldn't be longs. You could call them LPARAM (import
- Jacob Carlborg (8/12) Jan 23 2014 A "long" in C is actually a D "int" on Windows. On Posix it's a D "int"
hello. having trouble importing WinAPI function EnumWindows. example: //****************************************** module main; pragma(lib, "user32"); alias int function (void*, long) WNDENUMPROC; extern (Windows) int EnumWindows(WNDENUMPROC, long); //extern (Windows) void* CreateToolhelp32Snapshot(int, int); int main(string[] args) { //auto hSnapshot = CreateToolhelp32Snapshot(0x2, 0); EnumWindows( &EnumWindowsProc, 0 ); return 0; } int EnumWindowsProc(void* hwnd, long lParam) { return 1; } / / ****************************************** have when compiling error: Symbol Undefined _EnumWindows 12 other WinAPI functions imported successfully. the reason for the error?
Jan 23 2014
"AntonSotov" wrote in message news:qyxvsktbxokfhwebgwdk forum.dlang.org...extern (Windows) int EnumWindows(WNDENUMPROC, long);The second argument is LPARAM, which maps to C's long, but D's long maps to C's long long. To be safe, use these aliases whenever possible by using: import core.sys.windows.windows;
Jan 23 2014
all thank you very much! realized my mistake.
Jan 24 2014
On Thursday, 23 January 2014 at 17:22:55 UTC, AntonSotov wrote:alias int function (void*, long) WNDENUMPROC; extern (Windows) int EnumWindows(WNDENUMPROC, long);These shouldn't be longs. You could call them LPARAM (import core.sys.windows.windows) or int. A "long" in C is actually an "int" in D. D's "long" is more like C's "long long".
Jan 23 2014
On 2014-01-23 18:27, Adam D. Ruppe wrote:These shouldn't be longs. You could call them LPARAM (import core.sys.windows.windows) or int. A "long" in C is actually an "int" in D. D's "long" is more like C's "long long".A "long" in C is actually a D "int" on Windows. On Posix it's a D "int" when compiling for 32bit and a D "long" when compiling for 64bit. This is a simplification that holds for the most common platforms available today. For more details see: -- /Jacob Carlborg
Jan 23 2014