World Library  
Flag as Inappropriate
Email this Article


Article Id: WHEBN0006727540
Reproduction Date:

Title: Crt0  
Author: World Heritage Encyclopedia
Language: English
Subject: Executable, Runtime library, Execution (computing), Compiler, Interpreter (computing)
Collection: C Standard Library
Publisher: World Heritage Encyclopedia


crt0 (also known as c0) is a set of execution startup routines linked into a C program that performs any initialization work required before calling the program's main function. It generally takes the form of an object file called crt0.o, often written in assembly language, which is automatically included by the linker into every executable file it builds.[1]


  • crt0 1
  • crt1 2
  • See also 3
  • References 4
  • External links 5


crt0 contains the most basic parts of the runtime library. As such, the exact work it performs depends on the program's compiler, operating system and C standard library implementation.[1] Beside the initialization work required by the environment and toolchain, crt0 can perform additional operations defined by the programmer, such as executing C++ global constructors and C functions carrying the GCC's ((constructor)) attribute.[2][3]

"crt" stands for "C runtime", and the zero stands for "the very beginning". However, when programs are compiled using GCC, it is also used for languages other than C. Alternative versions of crt0 are available for special usage scenarios; for example, the profiler gprof requires its programs to be compiled with gcrt0.[4]


crt1 is used in some environments that require "life before main" or "life after main", including global constructors and destructors. By contrast, crt0 needs only to prepare the C stack.

See also


  1. ^ a b "The C Runtime Initialization, crt0.o". 2010. Retrieved 2013-12-30. 
  2. ^ "Program initialization". 2014-02-25. Retrieved 2014-04-21. 
  3. ^ "Calling Global Constructors". 2014-04-08. Retrieved 2014-04-21. 
  4. ^ "Compiling a Program for Profiling". Retrieved 2013-12-30. 

External links

  • crt0.o vs crt1.o
  • Linux x86 program start-up
  • Hello from a libc-free world! (Part 1), March 16, 2010

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from World eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.