Why do I need to include the DirectX dll if I only use DirectSound? [CS/C#]

Shaitan00

Well-known member
Joined
Aug 11, 2003
Messages
343
Location
Hell
Had a quick question regarding using Managed Directx (C#), their corresponding DLLs, and references in my project...

Currently I have a few classes that use ("using Microsoft.DirectX.DirectSound;") and therefore I have also included the reference to "Microsoft.DirectX.DirectSound" (from the list).
So I tested it out on some non-development machines and at first it just crashed, so I included "Microsoft.DirectX.DirectSound.dll" and yet it still crashed - after much plug-and-playing I realized that for my game to work it also needed "Microsoft.DirectX.dll", I just cant figure out why...

The only thing I use is DIRECTSOUND for playing music, I have no direct reference to DirectX.dll nor do I use it anywhere in my code, why do I also need to include this .dll? I would have assumed that all I needed to distribute with my application was "DirectSound.dll"

Is this normal? Is there a way around it? I hate having to include extra .dlls with my project and having a hard enough time swallowing that 174kb DirectSound.dll... (sucks that we need this additional dlls due to managed c#).
Any ideas, hints, and help would be greatly appreciated, thanks
 
The Microsoft.DirectX DLL must be included as it contains shared classes used by all DirectX components. But why would it be a problem? If the user needs DX/MDX then it should already be installed on the system and you shouldnt be distributing single DLLs from it.
 
DirectX, like most any programming library, is a whole unit, even if it is split up into multiple DLLs. Just as the Dotnet libraries would not work without mscorlib.dll, no DirectX libraries will work without Microsfot.DirectX.dll.

Besides that, distributing a single DLL is probably a violation of the license, hence illegal. Microsoft probably has a redistributable installer for managed DirectX (as they do for the Dotnet framework). If anything, that is what you should be passing out with your application. If you are distributing this application on the Internet, provide a link to a download on Microsofts website. If you are distributing via CD then you are going to have to cram the files on there.
 
mutant -> One thing I dont understand is why do I need to distribute these DLLs at all? I mean if the user has installed DirectX9.0c then do I only need to include these because it is MANAGED directx which was NOT included in the typical DX9.0c deployed in typical games?
I mean I run DXDIAG and it says DX9.0c but if I dont drop those two DLLs in the game folder it crashes... I would have assumed that if the user had already installed DX I would not have needed to ditribute any of these...


marble_eater -> So you are saying, even if they have DX9.0c installed (came with whatever games we installed on this machine over the past couple of years) I STILL need to have the users download the "directx_aug2006_redist.exe" (~50megs) and install it? Isnt that odd? And if they ONLY need DirectX.dll and DirectSound.dll why would they need to download/install the entire redlist?
 
The normal DirectX DLLs do not include managed DirectX. Most DirectX applications will not use managed DirectX, so managed DirectX will not be installed with most DirectX software that installs DirectX for you. Managed DirectX is a wrapper for DirectX that allows you to use it in a managed environment, essentially an add-on, therefore not normally included. I dont know if a DirectX download from Microsoft will include the managed DLLs.

If the user has DirectX installed they do not necessarily have the managed wrappers (managed DirectX DLLs) installed. If they dont, you need to distribute the managed DLLs. Whether they are available as a separate install or only in a full DirectX download I do not know.

You probably can not only distribute individual files because it is probably a violation of the license. If you want to distribute the files it is your responsibility to read the license. Why the license is written the way it is is not up to me, but one probable reason is that Microsoft most likely does not want users to have different version of different components of the same library.
 
Current download on the MS website lists Managed DX components as a part of the redistributable download, but that is through the web installer. If I remember correctly, the Managed components used to be an optional install, ran after the installation of the "normal" DirectX. It appears as though that was changed. The reason that this is not working for you/test computer is your DX version could have been installed from a redistributable which did not include MDX.
 
Back
Top