[AD] END_OF_MAIN, again

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


In my previous attempt to get rid of this macro I tried to place WinMain inside dll. This didn't work since WinMain need address of user's main and you can't have weak links inside dll. So I tried to place WinMain inside generated import library. This worked but linker would skip my WinMain and report it missing. I was searching trough MinGW archives and found answer. WinMain or any function in same file as WinMain must be referenced by user code or linker will skipp whole file. So I made dummy __install_allegro and place it with WinMain and macro original install_allegro to point mine. This worked like charm and I was able to compile all examples without any trouble.
After dll and import libraries are created I compiler wmain.c and include it in liballeg.a. This should work with MSVC too. About Linux/Unix/MacOS, I'm not sure that these use import libraries, but are using allegro-config which can be changed to include one more library (liballeg-main.a) that will contain real main.

Attachment: alwin.h.diff
Description: Binary data

Attachment: wmain.c
Description: Binary data



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