Page 1 of 1

how can i write a C++ kernel?

Posted: Thu Dec 04, 2003 2:21 am
by xiaohan
i write a kernel as "Writing a Kernel in C++"(http://www.invalidsoftware.net/os/?the_id=11),I do all the things exactly.
but the ld display a error message:

video.o: In function `Video::~Video(void)':
video.o(.text+0x33): undefined reference to `__builtin_delete'

why?
and what can i do to fix it?
thank you very much!

Re:how can i write a C++ kernel?

Posted: Thu Dec 04, 2003 2:29 am
by Pype.Clicker
hum.

i'm surprised to see this error in conjunction with -fno-builtin.

maybe you're missing an operator delete() or something

Re:how can i write a C++ kernel?

Posted: Thu Dec 04, 2003 2:38 am
by xiaohan
yes.
i did it only just as the start of that tutorial.
so i don't write operator delete();
but in that tutorial, it doesn't be used.
i must write it yet?

Re:how can i write a C++ kernel?

Posted: Thu Dec 04, 2003 2:41 am
by Pype.Clicker
it depends on where your video object is built, imho.

Code: Select all

   Video screen;

   main() {
       screen.clear();
       screen.text("Hello World");
   }
does not require any destructor as the object is permanent, while

Code: Select all

   main() {
       Video screen;

       screen.clear();
       screen.text("Hello World");
   }
will attempt to delete the screen when exitting main().

Re:how can i write a C++ kernel?

Posted: Thu Dec 04, 2003 4:07 am
by Solar
Exactly.

Either you create your Video object globally, or you have to supply operator new() and operator delete().

Since you are just starting, you probably don't have a memory management set up yet, so you should stick to the global Video object for now.