On Saturday, 4 February 2012 at 19:32:26 UTC, Stewart Gordon
wrote:
Under D1, std.c.windows.windows has HANDLE it as a typedef of
void*. While I forget whether they're actually pointers. I
guess it fits given that the C headers define it as void* and
that handles are fundamentally different from pointers from an
app's point of view.
Under D2, core.sys.windows.windows has it as an alias of void*.
In the WindowsAPI bindings, the definition of HANDLE is
versioned to this effect.
But there ought to be a better way of dealing with it. Anyone
got any thoughts? Are there any plans at the moment for the
future of the HANDLE type?
Stewart.
Just use the Win32 API way when STRICT is defined:
---
struct HANDLE__{ int unused; }
alias HANDLE__* HANDLE;
---
for different handles, just create a template that creates
different handles with different names:
---
mixin DEFINE_HANDLE("HWND");
// struct HWND__{ int unused; }
// alias HWND__* HWND;
---