Why i can overrid the main function?

The linker considers modules pulled in from a library "weak" in comparison to modules explicitly specified for inclusion.

Armed with the fact above and a verbose output from a build you should now be able to answer the question for yourself.