On Wed, 2007-08-08 at 18:15 -0700, Paul Pluzhnikov wrote:
> You can ask gcc not to add crt0.o (-nostdlib), and make liker set
> entry point to mymain(), but the result will likely crash either
> before or after mymain. For example, on my system:
> 
>     $ g++ -g junk.cpp -nostdlib -lstdc++ -lc -Wl,-emymain__Fv
>     $ ./a.out
>     my-main
>     Segmentation fault (core dumped)
> 
> This particular crash is happening because mymain() returns to
> address 0x00000001, which is actually argc, pushed onto stack by
> the kernel.

But you can always call exit() instead of returning. I tried it and it
seems to be working, but there's still the question, why do you need to
break the rules ? I just can't see the reason, can you point out to
them.

Regards,
-- 
John V. Shahid <[EMAIL PROTECTED]>




_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to