| Zeile 93: | Zeile 93: | ||
</cpp> | </cpp> | ||
| − | === Startup. | + | === Startup.cpp === |
Um die Konstruktoren bzw. die Destruktoren von globalen/statischen Objekten aufzurufen (siehe auch [[C++#globale.2Fstatische_Objekte|C++]]), werden diese beiden Funktionen später mit in den Kernel gelinkt und in der asmKernel.asm aufgerufen: | Um die Konstruktoren bzw. die Destruktoren von globalen/statischen Objekten aufzurufen (siehe auch [[C++#globale.2Fstatische_Objekte|C++]]), werden diese beiden Funktionen später mit in den Kernel gelinkt und in der asmKernel.asm aufgerufen: | ||
<cpp> | <cpp> | ||
| + | extern "C" void constructors(); | ||
| + | extern "C" void destructors(); | ||
| + | |||
void constructors() | void constructors() | ||
{ | { | ||
| Zeile 133: | Zeile 136: | ||
global loader ; Unser Einsprungspunkt | global loader ; Unser Einsprungspunkt | ||
extern main ; main() aus Kernel.cpp | extern main ; main() aus Kernel.cpp | ||
| − | extern destructors ; aus Startup. | + | extern destructors ; aus Startup.cpp |
| − | extern constructors ; aus Startup. | + | extern constructors ; aus Startup.cpp |
FLAGS equ 0 | FLAGS equ 0 | ||
| Zeile 173: | Zeile 176: | ||
gcc -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -ffreestanding -fno-exceptions -fno-leading-underscore -c -o Kernel.o Kernel.cpp | gcc -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -ffreestanding -fno-exceptions -fno-leading-underscore -c -o Kernel.o Kernel.cpp | ||
| − | Startup. | + | Startup.cpp: |
| − | gcc -m32 -nostdlib -fno-builtin -ffreestanding -fno-leading-underscore | + | gcc -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -ffreestanding -fno-exceptions -fno-leading-underscore -c -o Startup.o Startup.cpp |