DirectX header files

In a fairly recent episode (two-hundred something) Casey briefly mentioned during Q&A that in his project at Molly Rocket he is not including any header files for using DirectX. Can someone explain how this is possible? Maybe I just misunderstood his statement?

Thanks much.
Casey said that he uses OpenGL at Molly Rocket, and he loads the OpenGL functions himself from the DLL.

He doesn't use header DirectX header files because he doesn't use DirectX.
I'm pretty sure he simply defines structures/constants himself and declares function pointers to needed functions (that are loaded with GetProcAddress). This applies to regular Windows symbols as well as for OpenGL and DirectX.

For example, if you want to use "Sleep" function, then you do this:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
typedef void VOID;
typedef unsigned int DWORD;
#define WINAPI __stdcall

VOID (*WINAPI Sleep)(DWORD dwMilliseconds);

...
// somehwhere in initialization code
Sleep = (VOID (*WINAPI)(DWORD))GetProcAddress(kernel32, "Sleep");

...
// somehwere where you want to use it
Sleep(100);

Of course you can improve all that crazy function pointer casts with helper macros, same as on HandmadeHero stream.

You only need to link to kernel32.dll file to get GetProcAddress un GetModuleHandle functions.

Edited by Mārtiņš Možeiko on
I understand how to retrieve function ptrs to the Win32 API. However, if you are using DirectX, and maybe Casey is not based on marcc's answer, then you would have to know interface definitions, GUIDs, etc. none of which are part of a DLL's exports.
Yes you have. You either copy them from MSDN or from official headers into your code.

Edited by Mārtiņš Možeiko on
Makes sense. I missed the copy-n-paste from official headers into your codebase to avoid #include'ing things you may not want/need. Thanks much mmozeiko.