Re: [AD] No need for END_OF_MAIN (Windows)

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


How about this:

allegro header:
    #define main _mangled_main

allegro source:
   int _mangled_main();
   int __stdcall WinMain(void *hInst, void *hPrev, char *Cmd, int nShow)
   {
      return _WinMain((void *)_mangled_main, hInst, hPrev, Cmd, nShow);
   }

If I get this right _mangled_main inside library will be unresolved
(weak link or whatever) after building library and resolved to user
main() during final linking.
I made small example that has main() inside library (.a) and calls
function that is inside user code and it works :)




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