Re: [AD] Weak symbols in *nix (was: [AD] Magic main in Windows)

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


> Ok, I'll change it to use a constructor always and not output a weak 
> symbol.

I've committed the attached patch. It removes the weak symbol declaration 
of allegro_icon and makes the outputfile produced by xfixicon.sh always 
use Allegro's constructor function defines.
It also adds a check to see if Allegro indeed has X11 support, so that the 
file can be safely included in the list of sourefiles even if X is not 
present or if UNIX is not used.

Evert
Index: allegro/src/x/xwin.h
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xwin.h,v
retrieving revision 1.14
diff -u -r1.14 xwin.h
--- allegro/src/x/xwin.h	11 Jul 2004 10:33:10 -0000	1.14
+++ allegro/src/x/xwin.h	3 Aug 2004 08:22:22 -0000
@@ -27,12 +27,9 @@
 AL_VAR(int, _xwin_last_line);
 AL_VAR(int, _xwin_in_gfx_call);
 
-/* Weak symbol declaration for the allegro_icon - only supported in gcc */
-#ifdef ALLEGRO_GCC
-AL_VAR(void *, allegro_icon __attribute__((weak)));
-#else
+/* The allegro X11 icon */
 AL_VAR(void *, allegro_icon);
-#endif
+
 
 AL_FUNC(int, _xwin_open_display, (char *name));
 AL_FUNC(void, _xwin_close_display, (void));
Index: allegro/tools/x11/xfixicon.sh
===================================================================
RCS file: /cvsroot/alleg/allegro/tools/x11/xfixicon.sh,v
retrieving revision 1.3
diff -u -r1.3 xfixicon.sh
--- allegro/tools/x11/xfixicon.sh	11 Jul 2004 11:37:18 -0000	1.3
+++ allegro/tools/x11/xfixicon.sh	3 Aug 2004 08:22:22 -0000
@@ -38,9 +38,7 @@
 
 echo "#include <allegro.h>" > $outfile
 cat /tmp/allegico_xpm.xpm | sed -e 's,static char,static const char,' >> $outfile
-echo "#ifdef ALLEGRO_GCC" >> $outfile
-echo "void *allegro_icon = allegico_xpm;" >> $outfile
-echo "#elif defined ALLEGRO_USE_CONSTRUCTOR" >> $outfile
+echo "#if defined ALLEGRO_WITH_XWINDOWS && defined ALLEGRO_USE_CONSTRUCTOR" >> $outfile
 echo "extern void *allegro_icon;" >>  $outfile
 echo "CONSTRUCTOR_FUNCTION(static void _set_allegro_icon(void));" >> $outfile
 echo "static void _set_allegro_icon(void)" >> $outfile


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