How do you program an OS in c++ without the libraries at han

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.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by distantvoices »

KISS?! You don't mean that crazy heavy metal band, do you?
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:How do you program an OS in c++ without the libraries at

Post by Candy »

beyond infinity wrote: KISS?! You don't mean that crazy heavy metal band, do you?
KISS: Keep It Simple, Stupid!

no, that wasn't even personal but actually in the acronym.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by bubach »

beyond infinity: Have you been living in a box the last couple of years? :P
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by distantvoices »

@bubach: yeah: in a house. For 30 years now. *chuckle* Sure you too are living in such an odd thing are you? *sfg*

You know KISS?
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
ineo

Re:How do you program an OS in c++ without the libraries at

Post by ineo »

Solar wrote: I admit I haven't (since I went KISS, and not very far for that matter), but I didn't find any references to indicate they were not working out-of-the-box. Thanks for the warning (in case I'd pick up my kernel project sometime).
Well, the C++ ABI is a good starting point. The gcc implementation can be found in gcc source under "libsupc++". That's what is needed for gcc to support c++.
If I remember correctly, virtual functions need support because of the pure virtual exception that is thrown...
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by bubach »

I meant a really small box, with no connection to the world whatsoever.. :P
KISS is wellknown around here, you can't have missed it.. ;)
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by distantvoices »

Ah! You mean HERE! *rofl* And I have refered to real world aaaall the time. Now look, who is the unhappy hippopotamus here *lolbhtf*

Small box ... Hm, I'm about 2 meters tall. And sure you don't mean a wooden night gown, do you?];->
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by bubach »

lol.. well, no.
we better end this pointless thing now. ;)
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
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 do you program an OS in c++ without the libraries at

Post by Pype.Clicker »

am i hearing distant voices from beyond infinity talking about a mystical box where people have "house" instead of homepages ?

and what's that "real world" you're all talking about ?

soz. currently reading a novel by Tad Williams (otherland) about minds trapped in omnipresent-VR-internet-has-become... couldn't resist
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by Solar »

ineo wrote: The gcc implementation can be found in gcc source under "libsupc++". That's what is needed for gcc to support c++. If I remember correctly, virtual functions need support because of the pure virtual exception that is thrown...
Ah, but virtual functions and pure virtual functions are two different beasts - and you could easily avoid pure virtuals if the exception is all you have to worry about.

It would be interesting to have someone verify the capability of using virtual / pure virtual functions in kernel space without additional support code.
Every good solution is obvious once you've found it.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by distantvoices »

Pype.Clicker wrote: am i hearing distant voices from beyond infinity talking about a mystical box where people have "house" instead of homepages ?

and what's that "real world" you're all talking about ?

soz. currently reading a novel by Tad Williams (otherland) about minds trapped in omnipresent-VR-internet-has-become... couldn't resist
Ah, Otherland ... that's one cool series. More than just a bit dark I daresay, but really good. And that cruel murderer with his twist ... oh lad. Already got a clue why that vr-specialist woman is blind and why they can't escape from VR? *gg* in which part of the four volumes are you?
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
ineo

Re:How do you program an OS in c++ without the libraries at

Post by ineo »

Solar wrote: It would be interesting to have someone verify the capability of using virtual / pure virtual functions in kernel space without additional support code.
I'll check that tonight. I did some tests a year ago, I think I still have it at home.

Here are the results I remember:
- You can use virtual method (& inheritance) "out-of-the-box"
- You must reimplement libsupc++ for exceptions (stack unwinding :( ), new, delete, pure virtual.

But I always considered C++ as a whole, that's why it was obvious I needed the libsupc++ part. But that's a design choice, maybe not the best one.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by Solar »

My main consideration why I want my kernel in C++ is the better scoping (namespaces, class members), syntax (kout << ... instead of printf(...)) and stricter error checking. That's why I was perfectly comfortable with not having new(), exceptions etc. - as long as the FirstStep kernel lasted. ;)
Every good solution is obvious once you've found it.
srg

Re:How do you program an OS in c++ without the libraries at

Post by srg »

Solar wrote: My main consideration why I want my kernel in C++ is the better scoping (namespaces, class members), syntax (kout << ... instead of printf(...)) and stricter error checking. That's why I was perfectly comfortable with not having new(), exceptions etc. - as long as the FirstStep kernel lasted. ;)
In theory, an operating system would be an excellent candidate for OO programming, as the devices in a machine are objects. Take the floppy drive for example, there could be member functions for reading and writing, plus properties for any other device registers etc.

srg
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:How do you program an OS in c++ without the libraries at

Post by Solar »

Yes, of course - that is a welcome bonus. But You can code at least object-based in plain C, too. And you don't need pure virtual functions to implement an OO kernel, either - that's what I wanted to say.

Overly ambitious object hierarchies are usually a telltale sign of someone infatuated with the OO paradigm, disliking templates and more at home with Java than with C++. ;) No offense intended. ;)
Every good solution is obvious once you've found it.
Post Reply