Note: This website is archived. For up-to-date information about D projects and development, please visit

Welcome to DDirectX9

This is a port of the Microsoft DirectX 9 headers to the D Language. They have been tested under dmd D 1.X, and should work with both phobos and tango.

There are bindings for DirectX under the win32 bindings project, but they appear to be incomplete and reorganized from the original headers. This project aims to remain as close as possible to the original header structure and functionality. In addition, these headers do not rely on any particular extra bindings or libraries.


Converting the Import Libraries

Microsoft import libraries are not in the same format as the import libraries used by the dmd compiler. It is necessary to convert these libraries to a compatible format before they can be linked into your application.

Copy d3d9.lib and d3dx9.lib (and any others you need) from the SDK into your project's link path. You can convert each one with the following:

coffimplib <libname>.lib -f

If you use a build system such as DSSS or Build, it should automatically link the necessary libraries upon header import.

Note: This will overwrite the lib file, so make sure you are using a copy.

In Progress

Most of the headers are translated and working. The following still needs to be completed:

  • d3dx9anim conversion
  • Missing a few of the operator overrides for the structs in d3dx9math and d3d9


I will primarily be attempting to maintain these bindings for any future SDK updates. I plan on adding Direct Input support at some point, though it is not specific to DirectX 9. Additionally, if I have enough time, I will port over the DirectX 10 headers.

Currently there has been no attempt to make the headers D2.X compatible. If there is enough demand (and they don't work as is), I will take a look at what needs to be done.

Examples of Usage

(coming soon)


There are almost guaranteed to be bugs, in particular with pointer references in function arguments. If you have code that works in C/C++, but the equivalent does not work in D, submit a ticket with the problematic code and I'll check the relevant headers for errors. I don't use every feature of DirectX, so many of these will not crop up in my normal usage.