C++ Bare Bones: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Creature (talk | contribs)
Added source tags
mNo edit summary
Line 26:
|}
 
Because there is no environment executing your kernel (you can't expect the bootloader to do this), you have to execute your own constructors (and possibly destructors). Both are described below. There is however discussion about whether executing the global destructors in your kernel makes any sense when you're shutting down (seeing as you're shutting the computer or OS down). It would probably be best to call these destructors only if you have specific object destructors that need to clean something up before the kernel is shut down (and you can't or don't want to explicitelyexplicitly call these). Note also that you should call the destructors in '''reverse''' order! This to make sure objects depending on other objects to exist may result in problems if not done correctly.
 
The vague linking sections should be split accrossacross multiple sections: you should put them in text, rodata, data and bss. Here is an example linker script:
 
<pre>