Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

runtime dependency to d3d9.dll because of Direct3DCreate9

63 views
Skip to first unread message

Willem de Jonge

unread,
Dec 6, 2007, 5:42:00 AM12/6/07
to
My 3D application uses (if possible) Direct3D 9, for this it calls
Direct3DCreate9(D3D_SDK_VERSION). Due to this call the executable is
hard-linked to d3d9.dll and will not load if DirectX 9 is not installed.
I would like to have a fallback path where the application can choose at
runtime to switch back to an earlier version of Direct3D or OpenGL, so I need
another method for creating the IDirect3D9 object.
Any help would be greatly appreciated.

Willem de Jonge

unread,
Dec 6, 2007, 8:20:01 AM12/6/07
to
I just solved it using dynamic loading of the library and getting the
entrypoint of the Direct3DCreate9 function.

For those who might need it:
HMODULE h = LoadLibrary("D3D9.DLL");
typedef IDirect3D9 * (WINAPI *pDirect3DCreate9)(UINT);
pDirect3DCreate9 proc = (pDirect3DCreate9)GetProcAddress(h,
"Direct3DCreate9");
LPDIRECT3D9 d = (*proc)(D3D_SDK_VERSION));

Chuck Walbourn [MSFT]

unread,
Dec 6, 2007, 5:06:33 PM12/6/07
to
You can certainly use the LoadLibrary technique, but it's really a question
of what versions of Windows are you expecting to support. Direct3D 9.0c is
built into Windows as of Windows XP SP2. Are you expecting your users to be
running older unsupported versions of Windows?

--
Chuck Walbourn
SDE, XNA Developer Connection

This posting is provided "AS IS" with no warranties, and confers no rights.


Willem de Jonge

unread,
Dec 10, 2007, 1:28:00 AM12/10/07
to
> built into Windows as of Windows XP SP2. Are you expecting your users to be
> running older unsupported versions of Windows?

Yes, many of our customers are munnicipalities which mostly don't run the
latest software. Many of them are running Windows 2000, without the latest
DirectX (IT policy forbids individual users to upgrade their DirectX or
drivers).

Willem de Jonge

0 new messages