Marcus Clyne <
maccaday@...> writes:
> I've got it to work, by adding a 'main' function to my shared object code.
>
> I don't understand why I need to do this though. I didn't think that
> main' functions were required in shared objects, and when I compile
> using the shell, it compiles ok without one. When I used the same
> code on my old system, it worked without needing to add one, even in
> the exec function executions.
>
> Could this be a bug in GCC? The version I'm using currently is 4.3.3.
>
> Alternatively, is there another option I should add when using exec
> functions to call GCC to prevent the need for adding 'main' functions?
If gcc works as you expect when invoked from the shell, then I don't
think it can be a bug in gcc. I think it must be a bug in the way that
you are invoking it from your program. Or maybe you have a shell alias
or something, who knows.
There is nothing magic about exec. The shell uses exec also. gcc does
not behave differently when invoked via exec or via the shell--it can't.
Ian