Portable C++ standard library

Programming, for all ages and all languages.
Post Reply
User avatar
AndrewAPrice
Member
Member
Posts: 2303
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Portable C++ standard library

Post by AndrewAPrice »

What implementations exists? Which would be the easiest to port to my OS?
My OS is Perception.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

Here's just a few, but since I have been unable to port any of them to my os I can't tell you which one is the easiest.

http://www.sgi.com/tech/stl/
http://synesis.com.au/software/stlsoft/
http://ustl.sourceforge.net/
http://www.stlport.org/
bregma
Member
Member
Posts: 25
Joined: Tue Oct 26, 2004 11:00 pm
Location: the back woods
Contact:

Re: Portable C++ standard library

Post by bregma »

MessiahAndrw wrote:What implementations exists? Which would be the easiest to port to my OS?
What C++ compiler are you using that does not come with a standard library?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Portable C++ standard library

Post by Combuster »

bregma wrote:
MessiahAndrw wrote:What implementations exists? Which would be the easiest to port to my OS?
What C++ compiler are you using that does not come with a standard library?
A compiler for his own OS, perhaps?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
AndrewAPrice
Member
Member
Posts: 2303
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Portable C++ standard library

Post by AndrewAPrice »

Combuster wrote:
bregma wrote:
MessiahAndrw wrote:What implementations exists? Which would be the easiest to port to my OS?
What C++ compiler are you using that does not come with a standard library?
A compiler for his own OS, perhaps?
When I said:
MessiahAndrw wrote:easiest to port to my OS?
I meant the my OS, since this is an osdev forum. I use GCC if you'd like to know.

Right now when I have time (I have too many college projects) I'm porting across the C standard library and writing wrappers for my own functions. I'll worry about C++ later.
My OS is Perception.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Portable C++ standard library

Post by pcmattman »

MessiahAndrw wrote:Right now when I have time (I have too many college projects) I'm porting across the C standard library and writing wrappers for my own functions. I'll worry about C++ later.
You could just port Newlib or another standard C library... Why reinvent the wheel?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: Portable C++ standard library

Post by Candy »

pcmattman wrote:
MessiahAndrw wrote:Right now when I have time (I have too many college projects) I'm porting across the C standard library and writing wrappers for my own functions. I'll worry about C++ later.
You could just port Newlib or another standard C library... Why reinvent the wheel?
You could just use Windows or another operating system... Why reinvent the wheel?
User avatar
AndrewAPrice
Member
Member
Posts: 2303
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Portable C++ standard library

Post by AndrewAPrice »

pcmattman wrote:You could just port Newlib or another standard C library... Why reinvent the wheel?
The way the most implementations of the standard C library handles some minor things like printing to the screen (printf()) is incompatible with the way my OS manages console output (a console output will eventually be a pointer to a type of window structure (the 3 window types planned for my window manager are: control-based (OS routines for optimized drawing of buttons/images/components), console-based, and direct-based (for 2d/3d/movie-drawing apps which require direct access to the window buffer and ignores the default window-manager drawing functions))).

Are nested brackets valid English (I used them in coding (like this (and this)))?
My OS is Perception.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Portable C++ standard library

Post by pcmattman »

Candy wrote:You could just use Windows or another operating system... Why reinvent the wheel?
<offtopic>
He's copying me!!! Stop it! Stop it!
(remembering childhood)
</offtopic>

Nested brackets are valid if you can still understand what is trying to be said, imho.
bregma
Member
Member
Posts: 25
Joined: Tue Oct 26, 2004 11:00 pm
Location: the back woods
Contact:

Re: Portable C++ standard library

Post by bregma »

MessiahAndrw wrote: The way the most implementations of the standard C library handles some minor things like printing to the screen (printf()) is incompatible with the way my OS manages console output (a console output will eventually be a pointer to a type of window structure (the 3 window types planned for my window manager are: control-based (OS routines for optimized drawing of buttons/images/components), console-based, and direct-based (for 2d/3d/movie-drawing apps which require direct access to the window buffer and ignores the default window-manager drawing functions))).
I sounds more like your planned implementation of the C library is incompatible with the design of the C library. The standard C file streams abstract such details away.

If you're interested in porting the GCC compiler suite, including the C++ standard library, for you OS, all you need do is provide a stadard C library. The easiest way to do that is to port an existing library -- say, newlib. That means you provide a core set of about 8 POSIX-like system calls (eg. write(), abort()) from your OS, and the rest just works.

There's nothing to stop you from providing a complete custom binding library for your own OS. But if you want to use the standard stuff, you'll have to do things in a standard way.

--smw
User avatar
AndrewAPrice
Member
Member
Posts: 2303
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Portable C++ standard library

Post by AndrewAPrice »

bregma wrote:There's nothing to stop you from providing a complete custom binding library for your own OS. But if you want to use the standard stuff, you'll have to do things in a standard way.

--smw
That's like forcing my OS to be designed a certain way - to treat the console as a file stream. The reason I'm inspired to write my OS is because I have some abstract ideas of how to do things. I don't want to be told "this is how a console works" - I don't want to turn it into Yet-Another-POSIX-Clone.
My OS is Perception.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

I suppose you could supply some kind of compatibility layer. That way you get to port things like GCC which (will run sub-optimally), but if programmers want to write a specific new app for your OS, they use your library and can expect better performance.

Adam
Post Reply