This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
More on entry point option for ld
- To: gcc at gcc dot gnu dot org
- Subject: More on entry point option for ld
- From: Jeff Parker <JEFFREY dot H dot PARKER at saic dot com>
- Date: Fri, 29 Jun 2001 10:49:53 -0400
My original message:
I would like to link an object file to existing programs that I could
call first, run some
initialization functions, then call the original 'main' function.
I've tried using the '-e <entry point>' option for 'ld' and can get to
my new function but
I don't get the expected arguments of 'argc and argv' that I would like
to pass the 'main'.
It seems that I'm getting separate strings.
What is the proper way to accomplish this?
Thanks for any help available.
End of original message.
Since then I've gotten the entry point option to work by using the
variable arguments commands of 'va_start' and 'va_arg'. I read the
variable list as strings, then populate the typical 'int argc' and 'char
*argv[]' and call 'main (int argc, char *argv[])'.
My only problem is that when exiting from 'main' back to my entry point
function, I get a Segmentation Fault.
Has anyone done this and seen this problem?