entry at other than main (was want to know)

James P. Holtman holtman at cbnews.ATT.COM
Fri Aug 25 06:45:06 AEST 1989


It is hard to understand why all the concern about starting up
the program at someplace other than 'main'. With some linkers,
the load module is always started at location 0, so if you wanted
some arbitrary program to have initial control, you had a 'jump'
instruction linked into location 0 to effect the transfer.

If you really want 'xyz' to have control in C, then get your own
version of the c startup routine (which sets up argc and argv
amoung other things) and which right now calls 'main', and change
it to call 'xyz'. If you want to do it dynamically, then have
your 'make' file create the startup routine with the name you
specify and then link it in.

People should be asking 'what is the program that I am trying to
solve', and not 'how do I want to solve it'. Every system has
some constraints in it that we have to live with, but in most
cases it does not prevent you from doing what you want to do, if
you just take a different view of the situation.

Jim Holtman



More information about the Comp.lang.c mailing list