WinAPI for druntime and OpenGL for deimos.

Walter Bright newshound2 at digitalmars.com
Fri Nov 23 13:21:50 PST 2012


On 11/23/2012 5:57 AM, Vladimir Panteleev wrote:
> There might be some incompatibilities, for example due to how the HANDLE type is
> declared. In C, you can use either 0 or NULL as a parameter to a function
> accepting an integer or pointer. In D, you cannot. IIRC, some types were
> declared differently in Druntime's modules and in the win32 bindings.
>
> If breaking code were not an issue, the best solution would be to make HANDLE a
> unique, opaque type (like a struct wrapping an intptr_t or void*) - which is
> exactly how it should be treated. It would need to support assignment/creation
> from "null" though.

This is why I don't approve of attempts to "fix" Windows APIs. It winds up being 
incompatible here and there, and breaks things.

We all know what HANDLE should be, but it isn't. The D definition of HANDLE 
should match what Microsoft's windows.h declares it as.

Any attempt to fix APIs to C libraries, etc., should be in a separate layer that 
goes on top of the D interface to those APIs.


More information about the Digitalmars-d mailing list