Index: function/examples2/sdl/main.st
===================================================================
--- function/examples2/sdl/main.st	(revision 510)
+++ function/examples2/sdl/main.st	(working copy)
@@ -3,6 +3,7 @@
 { import: TextLayout }
 { import: Box }
 { import: SDLSurface }
+{ include "SDL_main.h" }
 
 { import: debug }
 
@@ -193,5 +194,3 @@
 			    label: 'quit'             action: [:anEvent | OS exit: 0]).
     [window draw; dispatchEvent: window nextEvent] repeat.
 ]
-
-{ include "SDL_main.h" }
Index: function/examples2/sdl/SDL_main.h
===================================================================
--- function/examples2/sdl/SDL_main.h	(revision 510)
+++ function/examples2/sdl/SDL_main.h	(working copy)
@@ -1,3 +1,11 @@
-#if defined(MACH)
-# define main SDL_main
-#endif
+#include "SDL/SDL.h"
+
+int _pepsi_SDL_main(int argc, char *argv[], char **envp);
+
+int main(int argc, char *argv[])
+{
+  return _pepsi_SDL_main(argc, argv, 0);
+}
+
+#undef main
+#define main _pepsi_SDL_main
Index: function/examples2/sdl/Makefile
===================================================================
--- function/examples2/sdl/Makefile	(revision 510)
+++ function/examples2/sdl/Makefile	(working copy)
@@ -1,11 +1,14 @@
 OS		= $(shell ../idc -C os)
 
 SDLINC		= -J/usr/local/include -Jsdlprims
-SDLLIB		= -L/usr/local/lib -lSDLmain -lSDL
+SDLLIB		= -L/usr/local/lib -lSDL
 
 ifeq ($(OS),darwin)
-CLIBS		= -Wc,-framework -Wc,Cocoa
+  CLIBS		= -lSDLmain -Wc,-framework -Wc,Cocoa
 else
+  ifeq ($(OS),win32)
+    CLIBS		= -lmingw32 -lSDLmain
+  endif
 endif
 
 FT2INC		= -J/usr/local/include/freetype2
@@ -27,7 +30,7 @@
 	./main
 
 % : %.st $(LIBS)
-	$(IDC) $(IDFLAGS) $< $(LIBS) $(IDLIBS) -o $@ $(SDLLIB) $(FT2LIB) $(CLIBS)
+	$(IDC) $(IDFLAGS) $< $(LIBS) $(IDLIBS) -o $@ $(CLIBS) $(SDLLIB) $(FT2LIB)
 
 %.o : %.st
 	$(IDC) $(IDFLAGS) -c $< -o $@
