Windows Server 2008 R2
(1)
Windows Vista
(1)
Windows 7
(1)
Vista
(1)
XP
(1)
D2D1CreateFactory
(1)
DirectWrite
(1)
LoadLibrary
(1)

Making Direct2D optional?

Asked By docschnipp
07-Nov-09 04:47 PM
Hi,

I want to keep my binary compatible for xp up to win7. Therefore, I started
to implement a "driver" using GDI+ or Direct2D to output my graphics and UI.

Unfortunately, when I am linking d2d1.lib, the d2d1.dll is automatically
bound to my binary and can not be executed under Vista or XP.

I found that d2d1.dll actually has only one function exported that I need:
D2D1CreateFactory

I could use LoadLibrary and locate the function, but is it possible to keep
my binary compatible with XP when compiling it against the d2d1 libs?
How shall I configure the linker?

Thanks
doc

Take a look at the /DELAYLOAD linker option for an alternative

Chris24 replied to docschnipp
08-Nov-09 12:46 PM
Take a look at the /DELAYLOAD linker option for an alternative to
GetProcAddress.  Since you are only interested in one function, either
approach should work well.

Chris

LoadLibrary or perhaps DELAYLOAD should work.

Chuck Walbourn [MSFT] replied to docschnipp
10-Nov-09 05:56 PM
LoadLibrary or perhaps DELAYLOAD should work. For COM interfaces, it is
usually easiest to LoadLibrary the create function as part of your init
code, and the rest of it does not have any direct DLL binding.

Direct2D, DirectWrite, and Direct3D 11 are all deployed together. They are
all included in Windows 7 and Windows Server 2008 R2. They are all available
down-level on Windows Vista SP2 and Windows Server 2008 SP2 through KB
971644 (for consumers) or KB 971512 (for corporate networks using WSUS).

KB971644
http://go.microsoft.com/fwlink/?LinkId=160189

KB971512
http://support.microsoft.com/kb/971512

You should look at the DirectX SDK article "Direct3D 11 Deployment for Game
Developers"
http://msdn.microsoft.com/en-us/library/ee416644.aspx

--
--
-Chuck Walbourn
SDE, XNA Developer Connection

This posting is provided "AS IS" with no warranties, and confers no rights.
Post Question To EggHeadCafe