is main() provided by a library valid C ?

Daniel Jacobowitz drow@false.org
Fri May 20 13:00:00 GMT 2005


On Fri, May 20, 2005 at 04:33:22PM +0930, Alan Modra wrote:
> On Fri, May 20, 2005 at 08:38:47AM +0200, Peter S. Mazinger wrote:
> > Is it allowed (as of linking) that the function main() been provided by a 
> > shared or static library instead of an object (*.o) ?
> 
> The linker doesn't care.  main in a static library will definitely work.
> main in a shared lib will probably require a special startup file,
> ie. the code that runs from _start to main.

Well, it works without anything special on GNU/Linux as far as I know.

-- 
Daniel Jacobowitz
CodeSourcery, LLC



More information about the Binutils mailing list