Page 1 of 1

C++ kernel?

Posted: Thu Feb 05, 2009 4:15 am
by andrewq2
I know a lot of c++ and wanted to make an os but i see a lot of c tut's but no c++ and i don't want to learn c also then i might get confused. what i want to know is is it possible to write a kernel in c++ and if so is there any links to help me?

Posted: Fri Feb 06, 2009 1:39 am
by LordMage
It is completely possible, in the Tutorials by mike, he coments about possible releasing the demos in C++ even though to date he hasn't done it. The differences between c and c++ are small really. in c you use structs and typedefs, in c++ you use classes with public and private members. but the basic code is the same. It just takes different organization. I took all of the code in the tutorials here and converted it to namespaces and classes before I decided to go back to the drawing board. I will have to redo all of it based on what I have learned but I too plan on making my kernel c++. I don't know of any good tutorials for this but I do know where some demo code that will get you basically upto a cheap console without paging and such. I would suggest using mikes idt and gdt code instead of what is in the code I will show you. Although you can use the layout/format of what is in the code. anyway I wish you luck and here is the page you can find that sample at:

http://www.planet-source-code.com/vb/sc ... 8&lngWId=3

Again, I would say that is barebones and would benefit much from what is explained in mikes tutorials.

Posted: Fri Feb 06, 2009 5:51 pm
by Andyhhp
It is easy to addapt the tutorials as they stand to being in C++. I have always done my kernel in C++ while following the tutorials.

Due to time, and repeatedly breaking computer(s) i am a long way behind the tutorials in the ammount of code I have actually made.

However, when I managed to read my old partiton, I shall post the basic structure I have so you can use it as a pointer (excuse the pun) if you want.

~Andrew