This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

More on entry point option for ld


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]