<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>main</title>
		<link>http://www.allegro.cc/forums/view/585957</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 18 Jun 2006 20:45:31 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi, i want to make a project with various libraries (no library does everything i want so i need to combine many) and Allegro is one of these</p><p>the only problem is that ALL libs want to control main()... and obviously only one can (trying resulted in linking errors)</p><p>is there a way in Allegro not to use the END_OF_MAIN stuff? i&#39;ve tried some stuff but  it just stopped working then</p><p>thanks!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AuriaG)</author>
		<pubDate>Fri, 16 Jun 2006 17:47:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Which libraries exactly are giving you problems? I think you should be able to use Allegro just fine without using END_OF_MAIN(). This as far as I can understand is just to make Allegro platform as platform independant as possible. Otherwise you&#39;d need a WinMain if you&#39;re making a Windows program for example...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Fri, 16 Jun 2006 17:51:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can define ALLEGRO_NO_MAGIC_MAIN and Allegro won&#39;t take over main (though you need to make sure to have the proper entry point and everything). Though this won&#39;t work for OSX, because it needs some really funky stuff that can&#39;t be gotten around.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Fri, 16 Jun 2006 18:13:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You can define ALLEGRO_NO_MAGIC_MAIN and Allegro won&#39;t take over main (though you need to make sure to have the proper entry point and everything). Though this won&#39;t work for OSX, because it needs some really funky stuff that can&#39;t be gotten around.
</p></div></div><p>That is, either pass -DALLEGRO_NO_MAGIC_MAIN to the compiler (or your compiler&#39;s equivalent), or define it <i>before</i> including allegro.h:
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define ALLEGRO_NO_MAGIC_MAIN</span>
<span class="p">#include &lt;allegro.h&gt;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Fri, 16 Jun 2006 18:26:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><i>Every</i> library wants to take control of main? That statistic is a bit surprising to me... I would have thought it was quite a bit less.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonny Cook)</author>
		<pubDate>Fri, 16 Jun 2006 19:28:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&gt; Though this won&#39;t work for OSX</p><p>Unfortunately i&#39;m using OSX... not using it gives a &quot;undefined symbol: _mangled_main_adress&quot; linking problem (without ALLEGRO_NO_MAGIC_MAIN)</p><p>with ALLEGRO_NO_MAGIC_MAIN, it compiles fine bug i get a signal 10 (sigbus) at runtime</p><p>&gt; Every library wants to take control of main? That statistic is a bit surprising to me... I would have thought it was quite a bit less.</p><p>Well it&#39;s only a way of speaking... i meant several libs i&#39;m using do
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AuriaG)</author>
		<pubDate>Sat, 17 Jun 2006 03:40:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What libraries are you using if several of them want to control main()?<br />That sounds like an odd behaviour for libraries that arent allegro-like.. but what do i know <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Sat, 17 Jun 2006 04:13:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You don&#39;t need WinMain on windows.... i&#39;ve used ALLEGRO_NO_MAGIC_MAIN with a regular main functon in windows before...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Sat, 17 Jun 2006 04:33:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&gt; What libraries are you using if several of them want to control main()?</p><p>well... i&#39;m a bit newbie so maybe you&#39;ll just tell me it makes no sense and i just can&#39;t do that <img src="http://www.allegro.cc/forums/smileys/embarassed.gif" alt=":-[" /> (i&#39;ve pretty much given up already)</p><p>i want to make an app using midi... so far Allegro is the only cross-platform framework doing midi playback with native drivers i&#39;ve found... however Allegro&#39;s GUI capabilities are too limited for my aapp so i wanted to build a GUI in wxWidgets... wxWidgets tries to control main by default, i&#39;ve found an option to disable it, it&#39;s fine but allegro doesn&#39;t work... depending on settings, i get compile errors, linking errors, or nothing happens at runtime (??)</p><p>but now i&#39;m realizing i think both of them want to control a main loop... so maybe i couldn&#39;t have both working except maybe in different threads?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AuriaG)</author>
		<pubDate>Sat, 17 Jun 2006 05:11:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So wx and Allegro?</p><p>I didn&#39;t know wx actually mangled the main function like allegro did <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" /></p><p>If you can tell wx to no mangle main, using the two together should be relatively simple. I think, though I have no idea how to do it under osx. (allegro windows has some neat functions to handle its win32 handles.)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Jun 2006 05:19:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>actually wx does not mangle main but creates a main function through preprocessor macros... the programmer instead uses a Init() method</p><p>however, as i said, i turned on an option to manually declare main, wx is working fine, but END_OF_MAIN() doesn&#39;t work and says: &quot;undefined symbol: _main&quot; i don&#39;t know why, main is there, and wx configured not to control main. however, the second i remove wx, allegro works fine again</p><p>if i use ALLEGRO_NO_MAGIC_MAIN, it compiles and launches, but allegro crashes with signal 10 sigbus</p><p>or maybe... are there specific compiler flags tha allegro takes... wx takes quite a bit of special compiler configuration, some of which wx-config just told me to put there and i&#39;m not 100% sure what they are... linking libs and stuff i believe so shouldn&#39;t create problems?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AuriaG)</author>
		<pubDate>Sat, 17 Jun 2006 05:30:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As was said, allegro can&#39;t work without the mangled main in OSX. So it seems that even once you tell wx to not controll main, it decides to mangle it in some way?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Jun 2006 05:36:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&gt; So it seems that even once you tell wx to not controll main, it decides to mangle it in some way?</p><p>i don&#39;t know... i would have thought it wouldn&#39;t, but it doesn&#39;t work, so it could be it... there&#39;s no workaround then, right?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AuriaG)</author>
		<pubDate>Sat, 17 Jun 2006 05:54:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You&#39;ll have to ask someone with more Wx knowledge, as I have very little.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Jun 2006 05:56:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://www.allegro.cc/forums/thread/495839">http://www.allegro.cc/forums/thread/495839</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Sat, 17 Jun 2006 05:56:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>BAF, you sure that will help him get it to work in OSX? Your code in that thread is for windows <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Jun 2006 06:02:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I may be pushing into OT territory, but have you considered using Qt4? It&#39;s cross-platform (it uses native widgets where possible), and though it&#39;s C++ instead of C, you may have better luck with the main() override problem. I am biased though, since wxWidgets uses GTK by default, and GTK apps look like <span class="cuss"><span>ass</span></span> to me. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>If all you need Allegro for is MIDI playback, have you looked at other libs? As much as I like Allegro, I&#39;ll be the first to admit it&#39;s MIDI handling is.. bad. Sure it &quot;works&quot;, but barely (most of the time, the only way to get MIDI is to use the DIGMID driver, which is built-in software wavetable driver; and a big hack, at that, since it does things you&#39;re not supposed to do). Unfortunately I can&#39;t think of many other cross-platform MIDI libraries. Any reason you want to use MIDI instead of modules (MOD, IT, etc) or Ogg?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Sat, 17 Jun 2006 06:46:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you do decide to go with Qt, I&#39;d gladly be a mentor <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>edit, to add to what KC there said about MIDI, allegro&#39;s player isnt quite 100%, it isnt 100% compatible with many midi files, and the DIGIMID driver can&#39;t handle some of the &quot;effects&quot;.. So if you have to have music, I&#39;d go with modules, or ogg.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 17 Jun 2006 06:48:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You don&#39;t need WinMain on windows.... i&#39;ve used ALLEGRO_NO_MAGIC_MAIN with a regular main functon in windows before...
</p></div></div><p>
Doesn&#39;t work reliably though. We tried that a couple of years ago; I think it worked in some situations but not in others (could be MinGW vs MSVC).<br />Unless you mean for what MS insists on calling a console application.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sat, 17 Jun 2006 13:00:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Doesn&#39;t work reliably though. We tried that a couple of years ago; I think it worked in some situations but not in others (could be MinGW vs MSVC).
</p></div></div><p>No, it works reliably. If you are compiling a Win32 application, gcc may have fallen back on a main function if it was available. MSVC will not. You can pass a command line option to MSVC to redefine the entry point.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Unless you mean for what MS insists on calling a console application.
</p></div></div><p>I don&#39;t understand what you are trying to say by this... it sounds very derogatory <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Sat, 17 Jun 2006 19:08:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i&#39;m trying things, right now i just want to reply to tons of wrong stuff i,ve read about wx</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You don&#39;t need WinMain on windows.... i&#39;ve used ALLEGRO_NO_MAGIC_MAIN with a regular main functon in windows before...
</p></div></div><p>

wait... i&#39;m on mac... you&#39;re mixing up platforms!</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
BAF, you sure that will help him get it to work in OSX? Your code in that thread is for windows
</p></div></div><p>

wxWidgets and Allegro are both cross-platform stuff, so code should be the same on all platforms</p><p>i&#39;ll try these code snippets and i&#39;ll come back</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I may be pushing into OT territory, but have you considered using Qt4? It&#39;s cross-platform (it uses native widgets where possible), and though it&#39;s C++ instead of C you may have better luck with the main() override problem.
</p></div></div><p>

wx is C++ too (??)</p><p>Qt 3 for mac was pure s**t<br />I don&#39;t know about Qt 4 though</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I am biased though, since wxWidgets uses GTK by default, and GTK apps look like <span class="cuss"><span>ass</span></span> to me. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div></div><p>
wx uses native APIs... GTK is for Linux/Unix! i&#39;m on mac, wx uses Carbon</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If all you need Allegro for is MIDI playback, have you looked at other libs? As much as I like Allegro, I&#39;ll be the first to admit it&#39;s MIDI handling is.. bad. Sure it &quot;works&quot;, but barely (most of the time, the only way to get MIDI is to use the DIGMID driver, which is built-in software wavetable driver; and a big hack, at that, since it does things you&#39;re not supposed to do). Unfortunately I can&#39;t think of many other cross-platform MIDI libraries. Any reason you want to use MIDI instead of modules (MOD, IT, etc) or Ogg?
</p></div></div><p>

yes i&#39;ve looked at many other libs... many good cross-platform libs offer midi manipulation, midi input from devices, but i haven,t found any that offers playback<br />(i absolutely need cross-platform)</p><p>actually i&#39;ve lookd at MOD/IT too, i&#39;d like to have them in addition of midi</p><p><b>EDIT:</b> i tried running the samples from the thread someone posted... it seems like wx+Allegro only work without magic_main... which isn&#39;t supportd on mac</p><p>guess i&#39;ll just drop it
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AuriaG)</author>
		<pubDate>Sat, 17 Jun 2006 20:29:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
No, it works reliably. If you are compiling a Win32 application, gcc may have fallen back on a main function if it was available. MSVC will not. You can pass a command line option to MSVC to redefine the entry point.
</p></div></div><p>
Are we talking about the same thing?<br />What I mean is having a regular main() function that that results in a fully functional normal Win32 GUI application. As far as I know, you can&#39;t do that and it didn&#39;t work properly when we tried it a couple of years ago.<br />If you know how to get this to work, can you submit a patch yesterday to remove END_OF_MAIN() for Windows?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I don&#39;t understand what you are trying to say by this... it sounds very derogatory <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" />
</p></div></div><p>
I was in a hurry, hence MS for Microsoft.<br />What I meant is that they make a distinction between a `console&#39; and a `GUI&#39; application, based on wether the programme has a WinMain() or a main() function. I think this is distinction is artificial, unnescessary. silly and pointless (not to mention that it makes it harder to port programmes from other operating systems).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 18 Jun 2006 00:40:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If you know how to get this to work, can you submit a patch yesterday to remove END_OF_MAIN() for Windows?
</p></div></div><p>Like I said, you need to tell cl with a command-line switch to use main as the entry point instead of WinMain. There might be a pragma for that, but I doubt it.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think this is distinction is artificial, unnescessary. silly and pointless
</p></div></div><p>Yeah, I am sure the only reason they had for doing so it to be able to change the parameters, which is easily avoided. Oh well. It goes without saying they didn&#39;t have portability in midn when they designed this <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (CGamesPlay)</author>
		<pubDate>Sun, 18 Jun 2006 01:16:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Like I said, you need to tell cl with a command-line switch to use main as the entry point instead of WinMain.
</p></div></div><p>
Ok. So can you make the patch or not? <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /><br />Or get someone else to do it?</p><p>EDIT: Oh wait... never mind... it doesn&#39;t help if we need a special switch when linking against Allegro, does it? <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 18 Jun 2006 02:05:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s possible the program&#39;s crashing for some other reason, such as loading bitmaps before allegro_init() or something.  Can you gdb the core file?  Or perhaps have it write &quot;progress report&quot; messages to a file as it goes, where the file ends should tell you approximately where it&#39;s crashing.  (maybe want to close the file after each message, then reopen it for next message)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Sun, 18 Jun 2006 05:00:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
It&#39;s possible the program&#39;s crashing for some other reason, such as loading bitmaps before allegro_init() or something. Can you gdb the core file? Or perhaps have it write &quot;progress report&quot; messages to a file as it goes, where the file ends should tell you approximately where it&#39;s crashing. (maybe want to close the file after each message, then reopen it for next message)
</p></div></div><p>

no, the code i&#39;ve tried is sure to be valid, it works on Windows - the crash occurs on allegro_init, most probably because the pointer to main is wrong (if i understaood correctly what END_OF_MAIN does)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AuriaG)</author>
		<pubDate>Sun, 18 Jun 2006 20:35:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
wxWidgets and Allegro are both cross-platform stuff, so code should be the same on all platforms
</p></div></div><p>Except that he used win_* api functions that are only available on allegro for windows.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 18 Jun 2006 20:45:31 +0000</pubDate>
	</item>
</rss>
