<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>d3d9.dll (and others) dynamically loaded?</title>
		<link>http://www.allegro.cc/forums/view/603813</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 20 Apr 2010 00:01:46 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Dynamic library loading facility has been introduced today into the Allegro 4.9 trunk.</p><p>It is disturbing for developers to track dependencies of static libraries. In fact I have no intention to know that Allegro is using this, this, this and that library and I should put proper ones on import list.</p><p>I would like to know your opinion about switching to dynamic loading for specified libraries:
</p><ul><li><p>d3d9.dll - Direct3DCreate9() and Direct3DCreate9Ex()</p></li><li><p>dsound.dll - DirectSoundCreate8()</p></li><li><p>dinput8.dll - DirectInput8Create()</p></li><li><p>opengl32.dll/gdi32.dll - WGL functions only and rest as extensions</p></li><li><p>psapi.dll - GetModuleFileNameEx()</p></li></ul><p>

This operation will reduce dependencies to:<br /> - dxguid.lib<br /> - winmm.lib</p><p>First can be eliminated by using static copies of used GUID&#39;s. They should not change in future.</p><p>That mean linking of static version of Allegro library to final application will reduce to two libs: winmm.lib and Allegro itself.</p><p>What&#39;s Your Opinion?</p><p><b>EDIT</b>:<br />Now list above is displayed correctly.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Sun, 18 Apr 2010 14:12:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Sounds good to me... but I&#39;m not a dev.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Mon, 19 Apr 2010 21:22:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In the attachments you can find patch for Direct3D9 driver. After applying D3D9 and D3D9Ex will be dynamically loaded from d3d9.dll.</p><p>I had tried to use _al_open_library() to handle dynamic libraries but those routines are not available while D3D is initialized, so I went back to WinAPI functions.</p><p>If approved I can provide patches for rest of mentioned libraries.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Mon, 19 Apr 2010 22:44:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think it complicates things too much. There should be a way (if there isn&#39;t already) to compile out any driver you don&#39;t need, but this is going too far.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Mon, 19 Apr 2010 22:48:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m confused what this is for. Why would you want any dynamic linking for a static build... isn&#39;t the point of a static build that you don&#39;t do dynamic linking? Do the current A4.9 static binaries require those .dll&#39;s to be present?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Mon, 19 Apr 2010 22:52:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, there is no static linking to D3D (and probably some others).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Mon, 19 Apr 2010 23:02:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Static version of Allegro depends on all mentioned libraries. All of those have to be linked by user application explicitly.</p><p>Some of those dependencies can be eliminated at compile time, but this is just stripping the functionality.</p><p>Users of Allegro provided as DLL don&#39;t have to worry about those things. Things are different when you want to create a monolith executable.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/603813/861482#target">Trent Gamblin</a> said:</div><div class="quote"><p>I think it complicates things too much. There should be a way (if there isn&#39;t already) to compile out any driver you don&#39;t need, but this is going too far.</p></div></div><p>
You don&#39;t agree because Allegro should depend on d3d9.lib or there is other reason?</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/603813/861484#target">SiegeLord</a> said:</div><div class="quote"><p>isn&#39;t the point of a static build that you don&#39;t do dynamic linking? Do the current A4.9 static binaries require those .dll&#39;s to be present?</p></div></div><p>
As far as I know static linking allow to reduce amount of dll&#39;s on which your application depends. In my case I use Allegro as static library so my final application is a single executable. Which is very suitable for casual games.</p><p>But still. Even static version of Allegro require d3d9.dll to be present on user system.</p><p>Most DirectX *.lib files are just import libraries for dll&#39;s and there is no way to link them statically.</p><p>The difference between statically linked D3D9 and dynamically linked D3D9 is that Allegro will not crash if d3d9.dll is not present on user system and then fallback to OpenGL is possible.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Mon, 19 Apr 2010 23:10:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If it overcomplicates things then maybe it&#39;s not that good after all. Most users will probably use the dynamic lib anyway, and those going with the static one can take the extra hassle. But don&#39;t mind me, this is up to you the devs.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kenmasters1976)</author>
		<pubDate>Mon, 19 Apr 2010 23:52:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well considering D3D9 comes with Vista and Windows 7, it&#39;s not much of any issue except on XP. On XP, probably 90% of people already have D3D installed (a lot of computer manufacturers will install it before the machine ships). If they don&#39;t have D3D9 libs installed, what makes you think they&#39;ll have OpenGL libs installed? The drivers usually come together. Sure, we could fall back on OpenGL 1.1 that comes with windows, but Allegro doesn&#39;t support that anyway. So I don&#39;t see any point in complicating the code for this.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Mon, 19 Apr 2010 23:57:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You got the point. It looks like I have to deal with those extra libraries as usual.</p><p>In fact I forgot about fact that Allegro require higher version of OpenGL than 1.1.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Tue, 20 Apr 2010 00:01:46 +0000</pubDate>
	</item>
</rss>
