how can i write a C++ kernel?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
xiaohan

how can i write a C++ kernel?

Post 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!
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

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

Post 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
xiaohan

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

Post 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?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

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

Post 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().
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

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

Post 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.
Every good solution is obvious once you've found it.
Post Reply