C / C++ FAQs & Programming Resources - ProkutFAQ : CFunctionBeforeMain

HomePage Recent Changes Recently Commented Login/Register
Quick Links
Categories
Links

Can we call any function before main function is called?

There is no portable way to do that. Few compiles provide extensions to designate a different function as start-up function, but thats not standard and portable( For Example: Turbo C provides #pragma startup directive), but its not standard and hence not a portable method. And in freestanding environments like embedded systems, any function can be made as start-up function, there is no requirement for main to be start-up function in such environments.
 Comments [Hide comments/form]
You can do it in C++
-- 117.97.70.22 (2009-05-07 17:22:39)
Page was generated in 0.0115 seconds