<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro 5, static font library problem</title>
		<link>http://www.allegro.cc/forums/view/607408</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 02 Jun 2011 07:13:19 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m having trouble getting A5 to work when statically linked. Maybe I&#39;m doing something wrong... but I don&#39;t know what else to try.</p><p>The following program crashes:
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="p">#include &lt;allegro5/allegro5.h&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;allegro5/allegro_font.h&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;allegro5/allegro_image.h&gt;</span>
<span class="number">  4</span><span class="p">#include &lt;allegro5/allegro_primitives.h&gt;</span>
<span class="number">  5</span><span class="p">#include &lt;allegro5/allegro_color.h&gt;</span>
<span class="number">  6</span><span class="p">#include &lt;allegro5/allegro_native_dialog.h&gt;</span>
<span class="number">  7</span>
<span class="number">  8</span><span class="p">#include &lt;stdio.h&gt;</span>
<span class="number">  9</span>
<span class="number"> 10</span><span class="k1">int</span> main<span class="k2">(</span><span class="k1">int</span> argc, <span class="k1">char</span> <span class="k3">*</span>argv<span class="k2">[</span><span class="k2">]</span><span class="k2">)</span>
<span class="number"> 11</span><span class="k2">{</span>
<span class="number"> 12</span>  <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span><a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span>
<span class="number"> 13</span>  <span class="k2">{</span>
<span class="number"> 14</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"Could not init Allegro.\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 15</span>    <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span>
<span class="number"> 16</span>  <span class="k2">}</span>
<span class="number"> 17</span>
<span class="number"> 18</span>  <span class="k1">if</span> <span class="k2">(</span>
<span class="number"> 19</span>      <span class="k3">!</span><a href="http://www.allegro.cc/manual/al_init_primitives_addon"><span class="a">al_init_primitives_addon</span></a><span class="k2">(</span><span class="k2">)</span> <span class="k3">|</span><span class="k3">|</span>
<span class="number"> 20</span>      <span class="k3">!</span><a href="http://www.allegro.cc/manual/al_install_keyboard"><span class="a">al_install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span> <span class="k3">|</span><span class="k3">|</span>
<span class="number"> 21</span>      <span class="k3">!</span><a href="http://www.allegro.cc/manual/al_install_mouse"><span class="a">al_install_mouse</span></a><span class="k2">(</span><span class="k2">)</span> <span class="k3">|</span><span class="k3">|</span>
<span class="number"> 22</span>      <span class="k3">!</span><a href="http://www.allegro.cc/manual/al_init_image_addon"><span class="a">al_init_image_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span>
<span class="number"> 23</span>  <span class="k2">{</span>
<span class="number"> 24</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"failed to initialize Allegro components.\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 25</span>    <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span>
<span class="number"> 26</span>  <span class="k2">}</span>
<span class="number"> 27</span>
<span class="number"> 28</span>  <a href="http://www.allegro.cc/manual/al_init_font_addon"><span class="a">al_init_font_addon</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// void funciton.</span>
<span class="number"> 29</span>
<span class="number"> 30</span>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"about to load font...\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 31</span>  <a href="http://www.allegro.cc/manual/ALLEGRO_FONT"><span class="a">ALLEGRO_FONT</span></a> <span class="k3">*</span>p_font <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_load_font"><span class="a">al_load_font</span></a><span class="k2">(</span><span class="s">"fixed_font.tga"</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 32</span>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"finished loading font.\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 33</span>
<span class="number"> 34</span>  <span class="k1">if</span> <span class="k2">(</span>p_font <span class="k3">=</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span>
<span class="number"> 35</span>  <span class="k2">{</span>
<span class="number"> 36</span>    <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"fixed_font.tga not found\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 37</span>    <span class="k1">return</span> <span class="n">1</span><span class="k2">;</span>
<span class="number"> 38</span>  <span class="k2">}</span>
<span class="number"> 39</span>
<span class="number"> 40</span>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"success\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 41</span>  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 42</span><span class="k2">}</span>
</div></div><p>
The only output is &quot;about to load font...&quot;.</p><p>Here is the makefile (which builds with no warnings or errors):
</p><pre class="terminal">CC=gcc
CFLAGS=-Wall -DMINGW32 -DNDEBUG -O2 -DALLEGRO_STATICLINK
LDFLAGS=-static-libgcc -static-libstdc++
LIBS=-lallegro -lallegro_primitives -lallegro_font -lallegro_image -lallegro_color
LIBS+=-lstdc++ -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32
LIBS:=$(LIBS:-lallegro%=-lallegro%-static)

test.exe: test.c
	$(CC) $(CFLAGS) $(LDFLAGS) $&lt; -o $@ $(LIBS)</pre><p>
It produces a command like this:
</p><pre class="terminal">gcc -Wall -DMINGW32 -DNDEBUG -O2 -DALLEGRO_STATICLINK -static-libgcc -static-libstdc++ test.c -o test.exe -lallegro-static -lallegro_primitives-static -lallegro_font-static -lallegro_image-static -lallegro_color-static -lstdc++ -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32</pre><p>
Which includes all of the libraries listed <a href="http://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_10.05_and_Allegro_5#Linking_to_Allegro_5_Statically">here</a> except -lgcc_eh, which gcc says it cannot find.<br />I&#39;m using MinGW, gcc v4.6.0.</p><p>To build allegro, downloaded v5.0.3  <span class="ref"><sup>[<a href="#">1</a>]</sup></span>, I unzipped it to C:\tools\allegro5, and from that directory I typed
</p><pre class="terminal">mkdir build
cd build
cmake-gui ..</pre><p>
First I selected mingw-makefiles, and generated the makefiles with the default settings.
</p><pre class="terminal">make
make install</pre><p>
It seemed to work with no problems.<br />I then invoked cmake-gui again, deselected SHARED and generated the makefiles again; and again did make and make install; again there didn&#39;t seem to be any problems.</p><p>So I think I&#39;ve installed allegro properly with shared and static libraries, and I think I&#39;m linking to all the right stuff, and I&#39;m compiling with ALLEGRO_STATICLINK defined as you can see - and it compiles without warnings or errors - but it crashes. (The non-static version works without problems.)</p><p>Have I missed something, or is this an allegro bug?</p><p>[edit]<br />By the way, fixed_font.tga is a file from the allegro examples data.
</p><div class="ref-block"><h2>References</h2><ol><li><a href="http://sourceforge.net/projects/alleg/files/allegro/5.0.3/">http://sourceforge.net/projects/alleg/files/allegro/5.0.3/</a></li></ol></div></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karadoc ~~)</author>
		<pubDate>Mon, 23 May 2011 08:11:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Can you try with the debug version (set CMAKE_BUILD_TYPE to Debug)? It should create an allegro.log which may help, but more importantly you should be able to get a gdb backtrace telling why it crashes. My suspicion is it has to do with gcc 4.6.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 26 May 2011 17:51:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>allegro.log:
</p><pre class="terminal">system   W C:\tools\allegro5\src\win\wsystem.c:550  load_library_at_path             [   0.00024] Failed to load C:\Programming\scratch\bug\d3d9.dll (error: 126)
system   I C:\tools\allegro5\src\win\wsystem.c:543  load_library_at_path             [   0.02992] Loaded C:\Windows\system32\d3d9.dll
d3d      I C:\tools\allegro5\src\win\d3d_disp.cpp:879  _al_d3d_init_display             [   0.13966] Render-to-texture: 1
system   I C:\tools\allegro5\src\system.c:268  al_install_system                [   0.13970] Allegro version: 5.0.3</pre><p>
backtrace:
</p><pre class="terminal">0	_al_register_destructor	dtor.c	161	0x407782	
1	al_create_bitmap	bitmap.c	145	0x423591	
2	_al_load_tga_f	tga.c	355	0x4c85d6	
3	_al_load_tga	tga.c	553	0x4c8ec5	
4	al_load_bitmap	bitmap_io.c	219	0x40ba5a	
5	_al_load_bitmap_font	fontbmp.c	149	0x4c5595	
6	al_load_font	font.c	350	0x4c472d	
7	main	test.c	31	0x4013f3	</pre><p>
more detailed backtrace:
</p><div class="spoiler"><pre class="terminal scroll">Thread 1 (Thread 4032.0xaa8):
#0  0x00407782 in _al_register_destructor (dtors=0x8e31f8, object=0x8e5e98, func=0x423596 &lt;al_destroy_bitmap&gt;) at C:\tools\allegro5\src\dtor.c:161
        dtor_owner_count = 0xd8
        __func__ = &quot;_al_register_destructor&quot;
#1  0x00423591 in al_create_bitmap (w=513, h=97) at C:\tools\allegro5\src\bitmap.c:145
        bitmap = 0x8e5e98
#2  0x004c85d6 in _al_load_tga_f (f=0x8e5e30) at C:\tools\allegro5\addons\image\tga.c:355
        image_id = &lt;data&gt;}
        id_length = 0 &#39;\000&#39;
        palette_type = 0 &#39;\000&#39;
        image_type = 2 &#39;\002&#39;
        palette_entry_size = 0 &#39;\000&#39;
        bpp = 32 &#39; &#39;
        descriptor_bits = 8 &#39;\b&#39;
        first_color = 0
        palette_colors = 0
        left = 0
        top = 0
        image_width = 513
        image_height = 97
        left_to_right = true
        top_to_bottom = false
        c = 5130702
        i = 5297452
        y = 5124283
        compressed = 8
        bmp = 0x50d52c
        lr = 0x4e30bb
        buf = 0x40e8fe &quot;UôB\004EôÇ@\030&quot;
        premul = true
        __func__ = &quot;_al_load_tga_f&quot;
#3  0x004c8ec5 in _al_load_tga (filename=0x4e30bb &quot;fixed_font.tga&quot;) at C:\tools\allegro5\addons\image\tga.c:553
        f = 0x8e5e30
        bmp = 0x8e5810
#4  0x0040ba5a in al_load_bitmap (filename=0x4e30bb &quot;fixed_font.tga&quot;) at C:\tools\allegro5\src\bitmap_io.c:219
        ext = 0x4e30c5 &quot;.tga&quot;
        h = 0x8e5810
        ret = 0x0
        __func__ = &quot;al_load_bitmap&quot;
#5  0x004c5595 in _al_load_bitmap_font (fname=0x4e30bb &quot;fixed_font.tga&quot;, size=0, flags=0) at C:\tools\allegro5\addons\font\fontbmp.c:149
        import_bmp = 0x4
        f = 0x8e5ba0
        backup = {_tls = &lt;data&gt;}
        range = {12582912, 127}
#6  0x004c472d in al_load_font (filename=0x4e30bb &quot;fixed_font.tga&quot;, size=0, flags=0) at C:\tools\allegro5\addons\font\font.c:350
        i = 1992920277
        ext = 0x4e30c5 &quot;.tga&quot;
        handler = 0x8e5ba0
#7  0x004013f3 in main (argc=1, argv=0x8e2e90) at test.c:31
        p_font = 0x7efde000</pre></div><p>
apparently <span class="source-code">dtor_owner_count <span class="k3">=</span> _al_tls_get_dtor_owner_count<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span></span> returned NULL, then <span class="source-code"><span class="k3">*</span>dtor_owner_count</span> caused a seg fault.<br />[edit]<br />&quot;dtor_owner_count = 0xd8&quot; not NULL. I just saw &quot;seg fault&quot; and assumed it must have been null.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karadoc ~~)</author>
		<pubDate>Thu, 26 May 2011 18:36:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hmm
</p><div class="source-code snippet"><div class="inner"><pre> <span class="n">160</span>    dtor_owner_count <span class="k3">=</span> _al_tls_get_dtor_owner_count<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
 <span class="n">161</span>    <span class="k1">if</span> <span class="k2">(</span><span class="k3">*</span>dtor_owner_count <span class="k3">&gt;</span> <span class="n">0</span><span class="k2">)</span>
 <span class="n">162</span>       <span class="k1">return</span><span class="k2">;</span>
</pre></div></div><p>

and</p><div class="source-code snippet"><div class="inner"><pre> <span class="n">871</span> <span class="k1">int</span> <span class="k3">*</span>_al_tls_get_dtor_owner_count<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
 <span class="n">872</span> <span class="k2">{</span>
 <span class="n">873</span>    thread_local_state <span class="k3">*</span>tls<span class="k2">;</span>
 <span class="n">875</span>    tls <span class="k3">=</span> tls_get<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
 <span class="n">876</span>    <span class="k1">return</span> <span class="k3">&amp;</span>tls-&gt;dtor_owner_count<span class="k2">;</span>
 <span class="n">877</span> <span class="k2">}</span>
</pre></div></div><p>

So &amp;tls-&gt;dtor_owner_count can&#39;t possibly be 0 or 0xd8 - I assume the crash means tls is NULL already and gdb just is confused because the function was inlined.</p><p>Which means, it&#39;s probably hitting an old bug with the Tls* functions. For some reason they are only called in DllMain but not when static linking but nobody ever fixed it so far. I don&#39;t know that Tls* API but assuming it&#39;s anything like pthread_create_key there should be no reason to need DllMain and it should be very easy to fix. I could be wrong though.</p><p>[edit:]</p><p>Here&#39;s an example how to use the Tls functions: <a href="http://msdn.microsoft.com/en-us/library/ms686991%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/ms686991%28v=vs.85%29.aspx</a></p><p>It doesn&#39;t mention DllMain. So it looks that whoever implemented this way back only implemented it for the DLL version but not for the static version (which is the much simpler case). And it was forgotten ever since <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> However the question is, why aren&#39;t there more reports of Allegro not working with static linking in Windows?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 26 May 2011 19:49:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Alright. I&#39;m looking into it now.</p><p>The thing is, I don&#39;t know anything about DllMain (other than <a href="http://msdn.microsoft.com/en-us/library/ms682583(v=vs.85).aspx">what I read a few seconds ago</a>), and I don&#39;t know anything about thread local storage or what it&#39;s purpose in allegro is.</p><p>From what I understand, allegro&#39;s DllMain function is responsible for allocating thread local storage for each thread allegro uses on windows. It is called every time a dll is loaded or unloaded. (it frees the allocated memory on the unload event.) So I suppose the problem is that when Allegro is statically linked, no dlls are loaded and so no thread local storage is allocated for new threads. My job then is to find where the threads are actually being created, and put the storage allocation there instead of in DllMain (or as well as in DllMain, depending on how it works.) I guess you&#39;re suggesting that I check out how the pthreads version works for comparison.</p><p>It is strange that no one else has reported this problem. I&#39;ve seen a bunch of threads where people discuss the steps required to get static linking working on Windows, so presumably at least some of these people did get it to work in the end...</p><p>[edit]<br />By the look of it, that DllMain stuff is only meant to be used for older versions of mingw.<br />I haven&#39;t found the problem yet, but I&#39;ve got a hunch that it&#39;s going to be something to do with bad defines somewhere causing allegro to get confused about which version of mingw I have. (ie. something related to 4.6.0, which is what you guessed in the first place.)<br />...<br />indeed, stepping through with the debugger reveals that this function is entered:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">static</span> thread_local_state <span class="k3">*</span>tls_get<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
<span class="k2">{</span>
   thread_local_state <span class="k3">*</span>t <span class="k3">=</span> TlsGetValue<span class="k2">(</span>tls_index<span class="k2">)</span><span class="k2">;</span>
   <span class="k1">return</span> t<span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
which is inside the following preprocessor condition </p><div class="source-code snippet"><div class="inner"><pre><span class="p">#if (defined ALLEGRO_MINGW32 &amp;&amp; ( \</span>
<span class="p">   __GNUC__ &lt; 4 || (__GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ &lt; 2) || \ </span>
<span class="p">   (__GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ == 2 &amp;&amp; __GNUC_PATCHLEVEL__ &lt; 1))) || \ </span>
<span class="p">   defined ALLEGRO_CFG_DLL_TLS </span>
</pre></div></div><p>

I ran the following test:
</p><div class="source-code snippet"><div class="inner"><pre>  <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"gcc v%d.%d.%d\n"</span>, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p> It prints 4.6.0.  So my guess now is that there is something wrong somewhere in the allegro build system.</p><p>...</p><p>It looks like this is the culprit:
</p><pre class="terminal">option(WANT_DLL_TLS &quot;Force use of DllMain for TLS (Windows)&quot; on)</pre><p>
I&#39;m recompiling now with WANT_DLL_TLS turned off.</p><p>...</p><p>lo and behold, the test program ran without crashing.</p><p>Now for the final test... I&#39;ll recompile the static release version of allegro, and the static release version of my actual game - then try to run it on a computer that doesn&#39;t have the allegro dlls.</p><p>...</p><p>Yes. It all works. Static link, dynamic link, everything.</p><p>So, based on that, I suggest the following patch:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k3">-</span><span class="k3">-</span><span class="k3">-</span> CMakeLists-old.txt  <span class="n">2011</span><span class="k3">-</span><span class="n">05</span><span class="k3">-</span><span class="n">27</span> <span class="n">13</span><span class="k2">:</span><span class="n">40</span><span class="k2">:</span><span class="n">49</span> <span class="k3">+</span><span class="n">1000</span>
<span class="k3">+</span><span class="k3">+</span><span class="k3">+</span> CMakeLists.txt      <span class="n">2011</span><span class="k3">-</span><span class="n">05</span><span class="k3">-</span><span class="n">27</span> <span class="n">13</span><span class="k2">:</span><span class="n">40</span><span class="k2">:</span><span class="n">03</span> <span class="k3">+</span><span class="n">1000</span>
@@ <span class="k3">-</span><span class="n">152</span>,<span class="n">7</span> <span class="k3">+</span><span class="n">152</span>,<span class="n">7</span> @@
 endif<span class="k2">(</span>NOT IPHONE<span class="k2">)</span>

 option<span class="k2">(</span>NO_FPU <span class="s">"No floating point unit"</span> off<span class="k2">)</span>
<span class="k3">-</span>option<span class="k2">(</span>WANT_DLL_TLS <span class="s">"Force use of DllMain for TLS (Windows)"</span> on<span class="k2">)</span>
<span class="k3">+</span>option<span class="k2">(</span>WANT_DLL_TLS <span class="s">"Force use of DllMain for TLS (Windows)"</span> off<span class="k2">)</span>
 option<span class="k2">(</span>WANT_DEMO <span class="s">"Build demo programs"</span> on<span class="k2">)</span>
 option<span class="k2">(</span>WANT_EXAMPLES <span class="s">"Build example programs"</span> on<span class="k2">)</span>
 option<span class="k2">(</span>WANT_POPUP_EXAMPLES <span class="s">"Use popups instead of printf for fatal errors"</span> on<span class="k2">)</span>
</pre></div></div><p>

By the way, does anyone want my collection of Allegro 5.0.3 binaries for MinGW 4.6.0?<br />I now have static release, static debug, and dynamic release. I guess it&#39;s still a long way short of all the flavours that the other binary packages have, but it&#39;s better than nothing, right?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karadoc ~~)</author>
		<pubDate>Fri, 27 May 2011 07:50:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh, indeed, I had read the code wrong. So the situation appears to be like this:</p><ul><li><p>MSVC: Uses __declspec(thread) both for DLL and static versions</p></li><li><p>MingW: Uses __thread both for DLL and static versions</p></li><li><p>The TLS API is only used when forced on with WANT_DLL_TLS or when the above #ifdef is true (for old mingw versions), and is only implemented for DLLs but not for static linking since it probably wasn&#39;t important enough (and now is even less so).</p></li></ul><p>

Does that sound right?</p><p>But for some reason there was this commit setting WANT_DLL_TLS to true:</p><p><a href="http://allefant.com/gitweb/?p=allegro.git;a=commitdiff;h=7ee13023bda58f83b66d54327ae8e157b6dc00fc">http://allefant.com/gitweb/?p=allegro.git;a=commitdiff;h=7ee13023bda58f83b66d54327ae8e157b6dc00fc</a></p><p>Which likely has broken static mingw versions since. The official binaries aren&#39;t built with cmake so they don&#39;t have WANT_DLL_TLS set so they always worked.</p><p>I&#39;ll apply your patch if nobody else does first...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Fri, 27 May 2011 15:12:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes. That sounds right.</p><p>I don&#39;t know much about these different thread systems, but I searched the code for &quot;ALLEGRO_CFG_DLL_TLS&quot; and the only place it comes up is in the #if statement I quoted earlier. As far as I know, the DllMain stuff is only required for gcc v4.2.0 and earlier versions - and the #if already checks for that regardless of ALLEGRO_CFG_DLL_TLS.<br />As for the commit which made WANT_DLL_TLS default to on, I don&#39;t know what the idea was there. My first guess was that the the gcc version checks weren&#39;t in place at that time - but that&#39;s not true. So I don&#39;t know. Maybe we should ask Trent about it.</p><p>Anyway. Thanks for your help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karadoc ~~)</author>
		<pubDate>Sat, 28 May 2011 11:36:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I asked Trent and he says it&#39;s better to use the TLS API, also with MSVC. So I&#39;ll try to change that #ifdef to never use the TLS API when static linking is on instead.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sat, 28 May 2011 14:39:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve posted a patch for this on sourceforge. I don&#39;t think I&#39;ve ever officially sent my patches like that before, so let me know if I&#39;ve done it wrong.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Karadoc ~~)</author>
		<pubDate>Thu, 02 Jun 2011 07:13:19 +0000</pubDate>
	</item>
</rss>
