is main() provided by a library valid C ?

Alan Modra amodra@bigpond.net.au
Fri May 20 07:28:00 GMT 2005


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.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list