<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>install_allegro() error</title>
		<link>http://www.allegro.cc/forums/view/576392</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 02 Apr 2006 07:03:09 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is the install_allegro line:
</p><div class="source-code snippet"><div class="inner"><pre>    <a href="http://www.allegro.cc/manual/install_allegro" target="_blank"><span class="a">install_allegro</span></a><span class="k2">(</span>SYSTEM_AUTODETECT, <span class="k3">&amp;</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_293.html" target="_blank">errno</a>, stabilize_before_exit<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

this is the exit function</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">int</span> stabilize_before_exit <span class="k2">(</span><span class="k1">void</span><span class="k2">)</span> <span class="k2">{</span>
    <a href="http://www.allegro.cc/manual/allegro_exit" target="_blank"><span class="a">allegro_exit</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

Currently this is just getting things set up properly, I haven&#39;t actually started anything real yet...</p><p>Anyway, the error I&#39;m getting is</p><p>invalid conversion from `int (*)()&#39; to `int (*)(void  (*)())&#39; </p><p>according to Dev-C++, on the install_allegro line. Anyone know what&#39;s going on?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Curtis Mackie)</author>
		<pubDate>Sun, 02 Apr 2006 06:00:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Remove the void inside your argument list.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Sun, 02 Apr 2006 06:03:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>didn&#39;t help
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Curtis Mackie)</author>
		<pubDate>Sun, 02 Apr 2006 06:09:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You don&#39;t have to call allegro_exit manually. What you are trying to do is actually done by allegro automatically <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Sun, 02 Apr 2006 06:13:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>thanks for the tip, but it still didn&#39;t help
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Curtis Mackie)</author>
		<pubDate>Sun, 02 Apr 2006 06:18:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Have you declared the function before using it in the callback?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Sun, 02 Apr 2006 06:25:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>the function is the first line in the source file, I&#39;ve tried it before and after #include &lt;allegro.h&gt;</p><p>sorry, I&#39;m not entirely sure what you mean by &quot;before using it in the callback&quot;
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Curtis Mackie)</author>
		<pubDate>Sun, 02 Apr 2006 06:32:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro.h&gt;</span>

<span class="k1">int</span> stabilize_before_exit <span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
  <a href="http://www.allegro.cc/manual/allegro_exit" target="_blank"><span class="a">allegro_exit</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</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="k2">{</span>
  <a href="http://www.allegro.cc/manual/install_allegro" target="_blank"><span class="a">install_allegro</span></a><span class="k2">(</span>SYSTEM_AUTODETECT, <span class="k3">&amp;</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_293.html" target="_blank">errno</a>, stabilize_before_exit<span class="k2">)</span><span class="k2">;</span>
  <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span>
<a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span>
</pre></div></div><p>

gcc -w -Wall helloworld.c `allegro-config --libs`</p><p>I get zero errors or warnings <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Sun, 02 Apr 2006 06:43:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Uhm....... as far as I know the last argument should point to atexit... that tells allegro what to call to register its own exit callback. Hence the void (*) error, because atexit takes a void*.</p><p>[edit]
</p><div class="quote_container"><div class="title">docs said:</div><div class="quote"><p>

The `errno_ptr&#39; and `atexit_ptr&#39; parameters should point to the errno variable and atexit function from your libc: these are required because when Allegro is linked as a DLL, it doesn&#39;t have direct access to your local libc data. `atexit_ptr&#39; may be NULL, in which case it is your responsibility to call allegro_exit() manually. Example:</p><p>      install_allegro(SYSTEM_AUTODETECT, &amp;errno, atexit);
</p></div></div><p>

Yep. So, if you want your own function called at the end, run atexit(stabilize_before_exit); in your main.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Sun, 02 Apr 2006 06:43:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>oh I see... sorry I misunderstood that feature. Okay, I got it now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Curtis Mackie)</author>
		<pubDate>Sun, 02 Apr 2006 06:47:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
because atexit takes a void*.
</p></div></div><p>No
</p><div class="quote_container"><div class="title">docs said:</div><div class="quote"><p>
#include &lt;stdlib.h&gt;</p><p>int atexit(void (*func)(void));<br /> <br /> This function places the specified function func on a list of functions to be called when exit is called. These functions are called as if a last-in-first-out queue is used, that is, the last function registered with atexit will be the first function called by exit. <br /> At least 32 functions can be registered this way.
</p></div></div><p>
<a href="http://www.delorie.com/djgpp/doc/libc/libc_52.html">http://www.delorie.com/djgpp/doc/libc/libc_52.html</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Sun, 02 Apr 2006 06:47:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A void * as in avoid function pointer.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Sun, 02 Apr 2006 07:03:09 +0000</pubDate>
	</item>
</rss>
