I?d like to re-write a kernel in C++ instead of C. I read that you have to do something special to be able to use global/static objects?
I tried to do it like this article:
http://www.invalidsoftware.net/os/?the_id=11
BUT when Im linking, I get the errormessage:
Loader.o(.text+0x1):Loader.o: undefined reference to `__main'
Loader.o(.text+0xb):Loader.o: undefined reference to `__atexit'
and I have no idea why. They are stored in a file called support.cpp, which I compile and link. I use DJGPP and nasm.
C++ instead o C
Re:C++ instead o C
and it?s weird because the file Loader.asm do finds the regular main function, but not the _main and _atexit.
Re:C++ instead o C
_atexit points to using the wrong compiler options. _atexit is a function usually supplied by the C/C++ runtime environment - which you do not have at your disposal when compiling your kernel.
You are probably using -ffreestanding; this option is not supported by G++. You might want to check out the FAQ on BareBonesC++.
You are probably using -ffreestanding; this option is not supported by G++. You might want to check out the FAQ on BareBonesC++.
Every good solution is obvious once you've found it.