Re: [AD] [ alleg-Bugs-2703105 ] remove END_OF_MAIN

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Attached is a first (rough) patch that removes the need for END_OF_MAIN from the OS X port (tested) and the Windows port (untested). END_OF_MAIN() is simply defined as an empty macro, which is mainly to safe myself the effort of removing it everywhere at this stage.
The only caveat is that the main() prototype needs to be "int main(int, char**) in C++.

For OS X, main.m should be forked off into a separate (add-on) library, otherwise main() mangling cannot be disabled. This should not be a problem in general except that there is a link between system.m and main.m related to disabling the screen saver. I'll have a look at this.

The Windows port is untested and I would be grateful if someone could test this. From previous discussion (http://www.allegro.cc/forums/thread/596872/756993#target), the implemented solution is
 1. Do nothing for MinGW
 2. Use a #pragma to set a linker option on MSVC
Someone should check that this solution still works on current implementations. What worries me in particular is that the particular linker option used (/ENTRY) is not listed as a linker option that can be set from a #pragma on MSDN (http://msdn.microsoft.com/en-us/library/7f0aews7(VS.80).aspx).
If it turns out it doesn't work anymore I can give Windows the same treatment as I do OS X.

I haven't touched the UNIX port since it doesn't require END_OF_MAIN() anyway and I haven't touched the iPhone port because I don't have a clue about how it works.

Anyway, this is mainly because I'd like someone to test the Windows side of this preliminary patch.

Evert

Attachment: no_magic_main_test1.diff
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/