[Scummvm-devel] Attn Porters: "main" now required

Max Horn max at quendi.de
Sun Apr 2 07:13:07 CEST 2006

For those not watching our Subversion commit mails closely, here's  
the news:

All backends now must implement main() or any other appropriate  
startup code. There is no main() in base/main.cpp anymore. Rather,  
the old main has been renamed to "scummvm_main".

Background: Many ports already did this. They needed to insert code  
that run before or after our main() routine, so they used all sorts  
of tricks (like #define main...) to hook in. So it seemed to be the  
natural and easiest way to simply make that the default behavior. For  
those ports that do not need to do special things in main(), it is  
trivial to update to this new setup -- just insert your own main()  
that invokes scummvm_main (see null.cpp and x11.cpp for examples).

I tried my best to bring over all ports, but I may have failed to do  
so properly in some cases. In particular, I believe the Symbian and  
PalmOS ports need some lovin' by their maintainers now. Please  
contact me if you need help with this or if anything is unclear about  
the required changes!

Besides making it simpler to "hook" into the startup code of ScummVM,  
this change makes some other improvements possible. In particular, I  
will soon commit a change that changes the way our OSystem instance  
is created -- namely, instead of being created indirectly (in common/ 
system.cpp), I will re-introduce the global g_system variable, and  
turn the responsibility of creating an OSystem instance over to the  
backends. The advantage is clear, I think: This improves the  
separation between backends, engines and glue code, making it even  
easier to create new backends (you don't have to mess with common/ 
system.cpp and backends/intern.h anymore, and ideally, can also leave  
base/main.cpp alone).

As always, your feedback and suggestions on further enhancements are  


More information about the Scummvm-devel mailing list