Re: [AD] alternate entry point for allegro programs

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


Chris wrote:

Peter Wang wrote:

There are other ways of getting the path, albeit probably less portable. Grabbing argv is too trivial a reason to hijack the definition of main.


I believe it hijacks main in Unix because argv[0] is, normally, exactly as typed on the command line (with possibly no/relative path info). This means Allegro would have to modify it to put in a proper/absolute path (like DJGPP/DOS does).


Huh?  I don't know how you got from what I wrote to what you wrote ;-)

Anyway, hijacking of main() happens in umain.c. This is done to get argc and argv, and store them into __crt0_argc and __crt0_argv. Apart from providing a bit of djgpp emulation, these are only used to implement get_executable_name() on Unix. But there are other ways to implement get_executable_name(), for example, looking up /proc/self/exe on Linux.

Peter





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