Evert wanted a more detailed description of my idea so here it is:
When compiling user code compiler will hit alwin.h; It will then define
main to _mangled_main. If current language is C++ (#ifdef __cplusplus)
it will declare _mangled_main(int, char **) as extern "C". This is used
so later only one prototype of C++ _mangled_main is needed.
When compiling allegro along with standard allegro (import) library,
more files are compiled but are not immediately included into lib. They
can't be put in DLL since they reference symbols that user need to
provide, but since import library is normal static library they can be
added later. Those files are wmain.cpp cmain.c cppmain.cpp
cmain.c: C style dummy _mangled_main
cppmain.cpp: C++ style dummy _mangled_main
wmain.cpp: Has WinMain(), it also references two wersions of
_maingled_main( C and C++(void)), acquire they addresses and calls
them. One of them will be resolved by linked as user _mangled_main and
other as allegro's dummy _mangled_main.