WinMain

Hello!

How is the call to WinMain supposed to look when
building Win* apps? I have looked at SDL_mangle.h,
and it seems that it inserts a RunMain or a
RunMain_something. Is this a gcc specific function
or what?

The reason I ask, is that I’m trying to modify a
C-code generating Standard ML compiler (MLTon)
to crosscompile to Windows and link with SDL…
Oh no, the second ML compiler actually! The first
one (MLKit) gave memory leaks…

It seems that I’m almost there, but I guess I
need to change the way it generates the main function…
In MLKit I could just include SDL_mangle.h, but
in MLTon I think the main function is generated by
the compiler…

I intend to publish my (quite incomplete) SDL::ML
bindings when I have successfully used it for writing
the game I’m working on now…

Cheers–
http://www.HardcoreProcessing.com

Hello!

How is the call to WinMain supposed to look when
building Win* apps? I have looked at SDL_mangle.h,
and it seems that it inserts a RunMain or a
RunMain_something. Is this a gcc specific function
or what?

The reason I ask, is that I’m trying to modify a
C-code generating Standard ML compiler (MLTon)
to crosscompile to Windows and link with SDL…
Oh no, the second ML compiler actually! The first
one (MLKit) gave memory leaks…

It seems that I’m almost there, but I guess I
need to change the way it generates the main function…
In MLKit I could just include SDL_mangle.h, but
in MLTon I think the main function is generated by
the compiler…

I intend to publish my (quite incomplete) SDL::ML
bindings when I have successfully used it for writing
the game I’m working on now…

Since gcc and VC++ do different things with main(), and neither
of them really map to WinMain(), SDL provides it’s own WinMain(),
which calls your application main(), which is redefined by a
preprocessor define to RunMain()

Yes, it’s ugly, but that’s Windows for ya. :slight_smile:

I’ll document it a little better when I get the VC++ code updated
in 0.11.2

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec