Undefined (Win32) Externals

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Jun 12 16:53:17 PDT 2011


Well most API functions stay the same for a long time on Windows.
Examples compiled in 1998 for Windows 98 will compile in 2011 for
Windows 7, and they will both run fine. At least the simple ones will.
The bindings /might/ be missing some new vista/win7 function
prototypes but I'm not sure if that's true or not. And if you use
vista/win7 features exclusively, you can say goodbye to compatibility
with pre-vista systems (if you care about that).

I'm not sure why your example is not compiling for you, it does for me:

import std.c.windows.windows;

extern (Windows)
{
       int GWL_USERDATA;
       LONG SetWindowLong(HWND, int, LONG);
       LONG GetWindowLong(HWND, int);
}

void main()
{
}

But try replacing the prototypes with this (notice the A at the end):
       LONG SetWindowLongA(HWND, int, LONG);
       LONG GetWindowLongA(HWND, int);

Which DMD version are you running?


More information about the Digitalmars-d mailing list