What!?
Don't
do that!
There are very few legitimate reasons to change a program's entry point from
main() (or, on Windows,
WinMain() ).
SDL doesn't change the entry point, it uses a trick to play with the
percieved entry point. (I don't think SDL's reason is legitimate anyway.)
If there is special library initialization that MUST be done, put it in a class instanciation in a library file, or a DLL loading entry point, or simply
require the user to call library initialization. Exactly how hard is this?
1 2 3 4 5 6 7 8
|
#include <iostream>
...
#include <foo.hpp>
int main( int argc, char** argv )
{
FooInit( argc, argv );
...
|
Why not use the Language Standard entry point?
If you are only asking about why there is
main() vs
WinMain() vs
DllMain() vs etc, then you are getting into the realm of compiler/OS extensions. A compiler can expect your main function to be called anything it wants; only the language requires it to be "main". Windows OS designers decided that there needs to be a change when initializing GUI code (which is significantly different than terminal program startup). You can still write GUI programs with
main(), but things are what they are...
Please don't add to the mess and make things difficult. Life is so much
easier if you just do things the Right Way.
Hope this helps.