Re: [AD] END_OF_MAIN removal patch for msvc

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, 2008-11-19 at 10:40 +0000, Peter Hull wrote:
> I'd rather have things out in the open instead of macro magic or some
> weaselly thread hacks. Could we not put the real main in a static lib
> and have the user put their code in allegro_main(). Real main would
> look like
> // For platforms that don't need a separate thread
> int main(int argc, char argv[])
> {
>  al_init();
>  return allegro_main(argc, argv);
> }
> 
> // For platforms that do
> int main(int argc, char argv[])
> {
>  al_init();
>  store_args_somewhere(argc, argv);
>  start_in_new_thread(allegro_main);
>  enter_main_loop();
>  // Never gets here
>  return 0;
> }
> 
> This would be OK for the straightforward 'pure' Allegro apps.
> 
> Then for the advanced user writing plugins or whatever they'd just
> have to write their own main() function maybe with some help from
> macros like AL_PLATFORM_NEEDS_SECONDARY_THREAD or whatever.
> 
> I know Jon Rafkind tried to mate Allegro 4 and Scheme and we just
> couldn't do it on OS X because of the threading issue.
> 

Since I think it will be one of the main improvements over A4, I'm
trying to get the ball rolling again on this. The attached patch would
be a first step. It simply replaces the END_OF_MAIN() macro by a direct
call to an "allegro_main" function which must be supplied by the user.

The Windows and OSX sides of the patch likely do not work as I could not
test them, but maybe someone who can will apply it and try fixing them.

If this works and the patch can be applied, the next step would be
modifying the build to have the real main in a separate library (so
language wrappers are not hampered by the "main" function in the base
library).

Finally, as was suggested in this thread, we could then likely
re-introduce something similar to:

#ifdef MAGIC_MAIN_WANTED
#define main allegro_main
#endif

But I think we should not.

-- 
Elias Pschernig <elias@xxxxxxxxxx>
Index: include/allegro5/platform/alunix.h
===================================================================
--- include/allegro5/platform/alunix.h	(revision 11361)
+++ include/allegro5/platform/alunix.h	(working copy)
@@ -25,17 +25,3 @@
 extern int    __crt0_argc;
 extern char **__crt0_argv;
 
-#ifdef ALLEGRO_WITH_MAGIC_MAIN
-
-   #ifndef ALLEGRO_NO_MAGIC_MAIN
-      #define ALLEGRO_MAGIC_MAIN
-      #define main _mangled_main
-      #undef END_OF_MAIN
-      #define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main;
-   #else
-      #undef END_OF_MAIN
-      #define END_OF_MAIN() void *_mangled_main_address;
-   #endif
-
-#endif
-
Index: include/allegro5/platform/alwin.h
===================================================================
--- include/allegro5/platform/alwin.h	(revision 11361)
+++ include/allegro5/platform/alwin.h	(working copy)
@@ -38,30 +38,7 @@
 #endif
 
 
-#if (!defined ALLEGRO_NO_MAGIC_MAIN) && (!defined ALLEGRO_SRC)
 
-   #define ALLEGRO_MAGIC_MAIN
-   #define main _mangled_main
-   #undef END_OF_MAIN
-
-   /* disable strict pointer typing because of the vague prototype below */
-   #define NO_STRICT
-
-   #ifdef __cplusplus
-      extern "C" int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *Cmd, int nShow);
-   #endif
-
-   #define END_OF_MAIN()                                                     \
-                                                                             \
-      int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *Cmd, int nShow)  \
-      {                                                                      \
-         return _WinMain((void *)_mangled_main, hInst, hPrev, Cmd, nShow);   \
-      }
-
-#endif
-
-
-
 /*******************************************/
 /************* system drivers **************/
 /*******************************************/
Index: include/allegro5/platform/alosx.h
===================================================================
--- include/allegro5/platform/alosx.h	(revision 11361)
+++ include/allegro5/platform/alosx.h	(working copy)
@@ -62,17 +62,7 @@
 extern int    __crt0_argc;
 extern char **__crt0_argv;
 
-#ifndef ALLEGRO_NO_MAGIC_MAIN
-   #define ALLEGRO_MAGIC_MAIN
-   #define main _mangled_main
-   #undef END_OF_MAIN
-   #define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main;
-#else
-   #undef END_OF_MAIN
-   #define END_OF_MAIN() void *_mangled_main_address;
-#endif
 
-
 /* System driver */
 #define SYSTEM_MACOSX           AL_ID('O','S','X',' ')
 /* Keyboard driver */
Index: demo/src/a5teroids.cpp
===================================================================
--- demo/src/a5teroids.cpp	(revision 11361)
+++ demo/src/a5teroids.cpp	(working copy)
@@ -12,7 +12,8 @@
    return -1;
 }
 
-int main(int argc, char **argv)
+extern "C" {
+int allegro_main(int argc, char **argv)
 {
    try {
 
@@ -106,5 +107,4 @@
 
    return 0;
 }
-END_OF_MAIN()
-
+}
Index: src/unix/umain.c
===================================================================
--- src/unix/umain.c	(revision 11361)
+++ src/unix/umain.c	(working copy)
@@ -18,28 +18,21 @@
 
 #include "allegro5/internal/alconfig.h"
 
-#ifdef ALLEGRO_WITH_MAGIC_MAIN
 
-#undef main
-
-
 extern int    __crt0_argc;
 extern char **__crt0_argv;
-extern void *_mangled_main_address;
 
+extern int allegro_main(int argc, char **argv);
 
-
 /* main:
  *  Replacement for main function (capture arguments and call real main).
  */
 int main(int argc, char *argv[])
 {
-   int (*real_main) (int, char*[]) = (int (*) (int, char*[])) _mangled_main_address;
-
    __crt0_argc = argc;
    __crt0_argv = argv;
 
-   return (*real_main)(argc, argv);
+   return allegro_main(argc, argv);
 }
 
-#endif
+
Index: src/macosx/main.m
===================================================================
--- src/macosx/main.m	(revision 11361)
+++ src/macosx/main.m	(working copy)
@@ -32,7 +32,6 @@
 /* For compatibility with the unix code */
 extern int    __crt0_argc;
 extern char **__crt0_argv;
-extern void *_mangled_main_address;
 
 static char *arg0, *arg1 = NULL;
 static int refresh_rate = 70;
@@ -220,11 +219,11 @@
 
 
 
+extern int allegro_main(int argc, char **argv);
 /* Call the user main() */
 static void call_user_main(void)
 {
-	int (*real_main)(int, char*[]) = (int (*)(int, char*[])) _mangled_main_address;
-	exit(real_main(__crt0_argc, __crt0_argv));
+	exit(allegro_main(__crt0_argc, __crt0_argv));
 }
 
 
Index: src/win/wnewsys.c
===================================================================
--- src/win/wnewsys.c	(revision 11361)
+++ src/win/wnewsys.c	(working copy)
@@ -141,6 +141,11 @@
    return i;
 }
 
+extern int allegro_main(int argc, char **argv);
+int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *Cmd, int nShow)
+{                                                                     
+   return _WinMain((void *)allegro_main, hInst, hPrev, Cmd, nShow); 
+}
 
 
 
Index: examples/ex_monitorinfo.c
===================================================================
--- examples/ex_monitorinfo.c	(revision 11361)
+++ examples/ex_monitorinfo.c	(working copy)
@@ -1,7 +1,7 @@
 #include "allegro5/allegro5.h"
 #include <stdio.h>
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_MONITOR_INFO info;
    int num_adapters;
@@ -24,6 +24,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_disable_screensaver.c
===================================================================
--- examples/ex_disable_screensaver.c	(revision 11361)
+++ examples/ex_disable_screensaver.c	(working copy)
@@ -2,7 +2,7 @@
 #include "allegro5/a5_font.h"
 #include <stdio.h>
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_FONT *font;
@@ -53,6 +53,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_config.c
===================================================================
--- examples/ex_config.c	(revision 11361)
+++ examples/ex_config.c	(working copy)
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include "allegro5/allegro5.h"
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_CONFIG *cfg;
    const char *value;
@@ -35,6 +35,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_font.c
===================================================================
--- examples/ex_font.c	(revision 11361)
+++ examples/ex_font.c	(working copy)
@@ -2,7 +2,7 @@
 #include "allegro5/a5_font.h"
 #include "allegro5/a5_iio.h"
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
     ALLEGRO_DISPLAY *display;
     ALLEGRO_BITMAP *bitmap;
@@ -50,6 +50,6 @@
     al_font_destroy_font(f);
     return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=4 sw=4 et: */
Index: examples/ex_blend2.cpp
===================================================================
--- examples/ex_blend2.cpp	(revision 11361)
+++ examples/ex_blend2.cpp	(working copy)
@@ -208,7 +208,8 @@
    al_restore_state(&state);
 }
 
-int main()
+extern "C" {
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_FONT *font;
@@ -272,6 +273,6 @@
 
    return 0;
 }
-END_OF_MAIN()
+}
 
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_audio_simple.c
===================================================================
--- examples/ex_audio_simple.c	(revision 11361)
+++ examples/ex_audio_simple.c	(working copy)
@@ -12,7 +12,7 @@
 #define RESERVED_SAMPLES   16
 #define MAX_SAMPLE_DATA    10
 
-int main(int argc, const char *argv[])
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_SAMPLE_DATA *sample_data[MAX_SAMPLE_DATA] = {NULL};
    ALLEGRO_DISPLAY *display;
@@ -111,6 +111,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_mouse_events.c
===================================================================
--- examples/ex_mouse_events.c	(revision 11361)
+++ examples/ex_mouse_events.c	(working copy)
@@ -25,7 +25,7 @@
    }
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *cursor;
@@ -109,6 +109,6 @@
    return 0;
 }
 
-END_OF_MAIN()
 
+
 /* vim: set sw=3 sts=3 et: */
Index: examples/ex_acodec.c
===================================================================
--- examples/ex_acodec.c	(revision 11361)
+++ examples/ex_acodec.c	(working copy)
@@ -8,7 +8,7 @@
 #include "allegro5/allegro5.h"
 #include "allegro5/acodec.h"
 
-int main(int argc, char **argv)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_VOICE *voice;
    ALLEGRO_MIXER *mixer;
@@ -115,6 +115,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_color.cpp
===================================================================
--- examples/ex_color.cpp	(revision 11361)
+++ examples/ex_color.cpp	(working copy)
@@ -144,7 +144,8 @@
    }
 }
 
-int main()
+extern "C" {
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_FONT *font;
@@ -181,6 +182,6 @@
 
    return 0;
 }
-END_OF_MAIN()
+}
 
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_bitmap_target.c
===================================================================
--- examples/ex_bitmap_target.c	(revision 11361)
+++ examples/ex_bitmap_target.c	(working copy)
@@ -138,7 +138,7 @@
    al_destroy_bitmap(target);
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
 
@@ -178,4 +178,4 @@
    
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_blend.c
===================================================================
--- examples/ex_blend.c	(revision 11361)
+++ examples/ex_blend.c	(working copy)
@@ -295,7 +295,7 @@
    ex.memory = al_create_bitmap(640, 480);
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_TIMER *timer;
@@ -333,4 +333,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_keyboard_events.c
===================================================================
--- examples/ex_keyboard_events.c	(revision 11361)
+++ examples/ex_keyboard_events.c	(working copy)
@@ -222,7 +222,7 @@
 
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    if (!al_init()) {
       TRACE("Could not init Allegro.\n");
@@ -263,6 +263,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set ts=8 sts=3 sw=3 et: */
Index: examples/ex_mouse_cursor.c
===================================================================
--- examples/ex_mouse_cursor.c	(revision 11361)
+++ examples/ex_mouse_cursor.c	(working copy)
@@ -49,7 +49,7 @@
    }
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display1;
    ALLEGRO_DISPLAY *display2;
@@ -199,6 +199,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_subbitmap.c
===================================================================
--- examples/ex_subbitmap.c	(revision 11361)
+++ examples/ex_subbitmap.c	(working copy)
@@ -44,7 +44,7 @@
 Mode mode = PLAIN_BLIT;
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_BITMAP *src_subbmp = NULL;
    ALLEGRO_BITMAP *dst_subbmp = NULL;
@@ -221,6 +221,6 @@
    return 0;
 }
 
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_icodec.c
===================================================================
--- examples/ex_icodec.c	(revision 11361)
+++ examples/ex_icodec.c	(working copy)
@@ -12,7 +12,7 @@
 #define WIDTH	640
 #define HEIGHT	480
 
-int main(int argc, char **argv)
+int allegro_main(int argc, char **argv)
 {
    int i;
    ALLEGRO_DISPLAY *display;
@@ -58,6 +58,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_mixer_chain.c
===================================================================
--- examples/ex_mixer_chain.c	(revision 11361)
+++ examples/ex_mixer_chain.c	(working copy)
@@ -8,7 +8,7 @@
 #include "allegro5/allegro5.h"
 #include "allegro5/acodec.h"
 
-int main(int argc, char **argv)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_VOICE *voice;
    ALLEGRO_MIXER *mixer;
@@ -124,6 +124,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_timedwait.c
===================================================================
--- examples/ex_timedwait.c	(revision 11361)
+++ examples/ex_timedwait.c	(working copy)
@@ -14,7 +14,7 @@
 
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *dpy;
    ALLEGRO_EVENT_QUEUE *queue;
@@ -40,10 +40,10 @@
 
    return 0;
 }
-END_OF_MAIN()
 
 
 
+
 static void test_relative_timeout(ALLEGRO_EVENT_QUEUE *queue)
 {
    ALLEGRO_EVENT event;
Index: examples/ex_lockscreen.c
===================================================================
--- examples/ex_lockscreen.c	(revision 11361)
+++ examples/ex_lockscreen.c	(working copy)
@@ -1,6 +1,6 @@
 #include "allegro5/allegro5.h"
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *bitmap;
@@ -45,4 +45,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_acodec_multi.c
===================================================================
--- examples/ex_acodec_multi.c	(revision 11361)
+++ examples/ex_acodec_multi.c	(working copy)
@@ -8,7 +8,7 @@
 #include "allegro5/allegro5.h"
 #include "allegro5/acodec.h"
 
-int main(int argc, char **argv)
+int allegro_main(int argc, char **argv)
 {
    int i;
    ALLEGRO_SAMPLE_DATA **sample_data;
@@ -125,4 +125,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_fs_resize.c
===================================================================
--- examples/ex_fs_resize.c	(revision 11361)
+++ examples/ex_fs_resize.c	(working copy)
@@ -18,7 +18,7 @@
    al_flip_display();
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *picture;
@@ -62,5 +62,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_threads.c
===================================================================
--- examples/ex_threads.c	(revision 11361)
+++ examples/ex_threads.c	(working copy)
@@ -90,7 +90,7 @@
 }
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_THREAD *thread[NUM_THREADS];
    Background background[NUM_THREADS] = {
@@ -122,7 +122,7 @@
 
    return 0;
 }
-END_OF_MAIN()
 
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_windows.c
===================================================================
--- examples/ex_windows.c	(revision 11361)
+++ examples/ex_windows.c	(working copy)
@@ -8,7 +8,7 @@
 const int H = 100;
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *displays[2];
    ALLEGRO_MONITOR_INFO *info;
@@ -96,5 +96,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_pixelformat.c
===================================================================
--- examples/ex_pixelformat.c	(revision 11361)
+++ examples/ex_pixelformat.c	(working copy)
@@ -47,7 +47,7 @@
 #define NUM_FORMATS  (sizeof(formats) / sizeof(formats[0]))
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_EVENT_QUEUE *queue;
@@ -178,6 +178,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_stream_file.c
===================================================================
--- examples/ex_stream_file.c	(revision 11361)
+++ examples/ex_stream_file.c	(working copy)
@@ -18,7 +18,7 @@
 //#define BYPASS_MIXER
 
 
-int main(int argc, char **argv)
+int allegro_main(int argc, char **argv)
 {
    int i;
    ALLEGRO_VOICE*  voice;
@@ -108,6 +108,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_ttf.c
===================================================================
--- examples/ex_ttf.c	(revision 11361)
+++ examples/ex_ttf.c	(working copy)
@@ -55,7 +55,7 @@
     al_font_textprintf_right(ex.f3, al_get_display_width(), 0, "%.1f FPS", ex.fps);
 }
 
-int main(int argc, const char *argv[])
+int allegro_main(int argc, char **argv)
 {
     const char *font_file = "data/DejaVuSans.ttf";
     ALLEGRO_DISPLAY *display;
@@ -129,6 +129,6 @@
     
     return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=4 sw=4 et: */
Index: examples/ex_keyboard_focus.c
===================================================================
--- examples/ex_keyboard_focus.c	(revision 11361)
+++ examples/ex_keyboard_focus.c	(working copy)
@@ -21,7 +21,7 @@
    al_flip_display();
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_COLOR black;
    ALLEGRO_COLOR red;
@@ -67,6 +67,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_user_events.c
===================================================================
--- examples/ex_user_events.c	(revision 11361)
+++ examples/ex_user_events.c	(working copy)
@@ -41,7 +41,7 @@
 }
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_TIMER *timer;
    ALLEGRO_EVENT_SOURCE *user_src;
@@ -114,6 +114,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_expose.c
===================================================================
--- examples/ex_expose.c	(revision 11361)
+++ examples/ex_expose.c	(working copy)
@@ -4,7 +4,7 @@
 const int W = 320;
 const int H = 200;
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *bitmap;
@@ -89,6 +89,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_multiwin.c
===================================================================
--- examples/ex_multiwin.c	(revision 11361)
+++ examples/ex_multiwin.c	(working copy)
@@ -5,7 +5,7 @@
 const int W = 640;
 const int H = 400;
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display[2];
    ALLEGRO_EVENT event;
@@ -114,6 +114,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_lines.c
===================================================================
--- examples/ex_lines.c	(revision 11361)
+++ examples/ex_lines.c	(working copy)
@@ -126,7 +126,7 @@
    al_flip_display();
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_EVENT event;
    ALLEGRO_KEYBOARD_STATE kst;
@@ -200,6 +200,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_threads2.c
===================================================================
--- examples/ex_threads2.c	(revision 11361)
+++ examples/ex_threads2.c	(working copy)
@@ -246,7 +246,7 @@
 }
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_THREAD *thread[NUM_THREADS];
    ALLEGRO_DISPLAY *display;
@@ -396,6 +396,6 @@
 
    return 1;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_bitmap.c
===================================================================
--- examples/ex_bitmap.c	(revision 11361)
+++ examples/ex_bitmap.c	(working copy)
@@ -1,7 +1,7 @@
 #include "allegro5/allegro5.h"
 #include "allegro5/a5_iio.h"
 
-int main(int argc, const char *argv[])
+int allegro_main(int argc, char **argv)
 {
     const char *filename;
     ALLEGRO_DISPLAY *display;
@@ -96,6 +96,6 @@
 
     return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=4 sw=4 et: */
Index: examples/ex_membmp.c
===================================================================
--- examples/ex_membmp.c	(revision 11361)
+++ examples/ex_membmp.c	(working copy)
@@ -74,7 +74,7 @@
    return quit;
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_FONT *accelfont;
@@ -121,4 +121,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_convert.c
===================================================================
--- examples/ex_convert.c	(revision 11361)
+++ examples/ex_convert.c	(working copy)
@@ -5,7 +5,7 @@
 #include "allegro5/a5_iio.h"
 
 
-int main(int argc, char **argv)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_BITMAP *bitmap;
 
@@ -40,5 +40,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_timer.c
===================================================================
--- examples/ex_timer.c	(revision 11361)
+++ examples/ex_timer.c	(working copy)
@@ -158,7 +158,7 @@
    }
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_TIMER *timer;
@@ -194,4 +194,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_winfull.c
===================================================================
--- examples/ex_winfull.c	(revision 11361)
+++ examples/ex_winfull.c	(working copy)
@@ -1,6 +1,6 @@
 #include "allegro5/allegro5.h"
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *win, *full;
    ALLEGRO_EVENT_QUEUE *events;
@@ -59,5 +59,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_drawpixels.c
===================================================================
--- examples/ex_drawpixels.c	(revision 11361)
+++ examples/ex_drawpixels.c	(working copy)
@@ -12,7 +12,7 @@
 } Point;
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_KEYBOARD_STATE key_state;
@@ -124,5 +124,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_glext.c
===================================================================
--- examples/ex_glext.c	(revision 11361)
+++ examples/ex_glext.c	(working copy)
@@ -191,7 +191,7 @@
 
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    GLuint pid;
    ALLEGRO_DISPLAY *d;
@@ -306,4 +306,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_resize2.c
===================================================================
--- examples/ex_resize2.c	(revision 11361)
+++ examples/ex_resize2.c	(working copy)
@@ -10,7 +10,7 @@
 #include <stdio.h>
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *bmp;
@@ -88,6 +88,6 @@
    return 0;
 
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_joystick_events.c
===================================================================
--- examples/ex_joystick_events.c	(revision 11361)
+++ examples/ex_joystick_events.c	(working copy)
@@ -122,7 +122,7 @@
 
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_JOYSTICK *zero_joy;
@@ -182,6 +182,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set ts=8 sts=3 sw=3 et: */
Index: examples/ex_opengl.c
===================================================================
--- examples/ex_opengl.c	(revision 11361)
+++ examples/ex_opengl.c	(working copy)
@@ -112,7 +112,7 @@
    glEnd();
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_EVENT_QUEUE *queue;
@@ -161,5 +161,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_lockbitmap.c
===================================================================
--- examples/ex_lockbitmap.c	(revision 11361)
+++ examples/ex_lockbitmap.c	(working copy)
@@ -1,7 +1,7 @@
 #include "allegro5/allegro5.h"
 #include "allegro5/a5_iio.h"
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *bitmap;
@@ -92,4 +92,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_dualies.c
===================================================================
--- examples/ex_dualies.c	(revision 11361)
+++ examples/ex_dualies.c	(working copy)
@@ -49,7 +49,7 @@
    al_destroy_display(d2);
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    if (!al_init()) {
       TRACE("Could not init Allegro.\n");
@@ -68,5 +68,5 @@
    return 0;
 
 }
-END_OF_MAIN()
 
+
Index: examples/ex_bitmap_flip.c
===================================================================
--- examples/ex_bitmap_flip.c	(revision 11361)
+++ examples/ex_bitmap_flip.c	(working copy)
@@ -50,7 +50,7 @@
 }
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_TIMER *timer;
@@ -121,6 +121,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_scale.c
===================================================================
--- examples/ex_scale.c	(revision 11361)
+++ examples/ex_scale.c	(working copy)
@@ -17,7 +17,7 @@
 
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    const int display_w = 640;
    const int display_h = 480;
@@ -133,4 +133,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_noframe.c
===================================================================
--- examples/ex_noframe.c	(revision 11361)
+++ examples/ex_noframe.c	(working copy)
@@ -3,7 +3,7 @@
 
 #include <stdio.h>
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *bitmap;
@@ -87,5 +87,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_mouse.c
===================================================================
--- examples/ex_mouse.c	(revision 11361)
+++ examples/ex_mouse.c	(working copy)
@@ -25,7 +25,7 @@
    }
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *cursor;
@@ -72,5 +72,5 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
Index: examples/ex_icon.c
===================================================================
--- examples/ex_icon.c	(revision 11361)
+++ examples/ex_icon.c	(working copy)
@@ -1,7 +1,7 @@
 #include <allegro5/allegro5.h>
 #include "allegro5/a5_iio.h"
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_DISPLAY *display;
    ALLEGRO_BITMAP *icon1;
@@ -50,4 +50,4 @@
 
    return 0;
 }
-END_OF_MAIN()
+
Index: examples/ex_saw.c
===================================================================
--- examples/ex_saw.c	(revision 11361)
+++ examples/ex_saw.c	(working copy)
@@ -68,7 +68,7 @@
 }
 
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_VOICE *voice;
    ALLEGRO_MIXER *mixer;
@@ -124,6 +124,6 @@
 
    return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_get_path.c
===================================================================
--- examples/ex_get_path.c	(revision 11361)
+++ examples/ex_get_path.c	(working copy)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include "allegro5/allegro5.h"
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
    char buffer[1024];
 
@@ -31,6 +31,6 @@
    return 0;
 }
 
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_path.c
===================================================================
--- examples/ex_path.c	(revision 11361)
+++ examples/ex_path.c	(working copy)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <allegro5/allegro5.h>
 
-int main(int argc, char **argv)
+int allegro_main(int argc, char **argv)
 {
    ALLEGRO_PATH *dyn = NULL;
    ALLEGRO_PATH *tostring = NULL;
@@ -61,6 +61,6 @@
    return 0;
 }
 
-END_OF_MAIN()
 
+
 /* vim: set sts=3 sw=3 et: */
Index: examples/ex_resize.c
===================================================================
--- examples/ex_resize.c	(revision 11361)
+++ examples/ex_resize.c	(working copy)
@@ -17,7 +17,7 @@
     al_flip_display();
 }
 
-int main(void)
+int allegro_main(int argc, char **argv)
 {
     ALLEGRO_DISPLAY *display;
     ALLEGRO_EVENT_QUEUE *events;
@@ -77,6 +77,6 @@
 
     return 0;
 }
-END_OF_MAIN()
 
+
 /* vim: set sts=4 sw=4 et: */


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/