For backward compatibility with previous versions of DirectX, some DirectX components include variable API element definitions in their header files. Affected elements are typically capability structures or flag sets that are version specific. Parts of some header files are surrounded by preprocessor conditionals that cause the preprocessor to effectively "filter-out" unneeded definitions. The value of the defined constant identifies a specific version of the component; if no value is defined, the headers set a value that identifies the DirectX version for which the header file was written. An example from the DirectDraw header file, ddraw.h, is shown here:
#ifndef DIRECTDRAW_VERSION
#define DIRECTDRAW_VERSION 0x0600
#endif /* DIRECTDRAW_VERSION */
The following table includes the components that use these version constants, their labels, and their default value for this release of DirectX.
Component | Label | Value |
---|---|---|
DirectDraw | DIRECTDRAW_VERSION | 0x0600 |
Direct3D Immediate Mode | DIRECT3D_VERSION | 0x0600 |
DirectInput | DIRECTINPUT_VERSION | 0x0600 |
You can define other values for these constants to use newer versions of the header files with previous versions of the components. For example, to use the latest headers to compile against the DirectX 3.0 version of DirectDraw, you would define DIRECTDRAW_VERSION to be 0x0300. You can set the value for the constant in your development environment, or you can change the value in the header file itself.