Page 1 of 1

Portable C++ standard library

Posted: Sat Jul 14, 2007 4:13 am
by AndrewAPrice
What implementations exists? Which would be the easiest to port to my OS?

Posted: Sat Jul 14, 2007 8:37 am
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/

Re: Portable C++ standard library

Posted: Fri Jul 20, 2007 6:27 am
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?

Re: Portable C++ standard library

Posted: Sat Jul 21, 2007 4:22 am
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?

Re: Portable C++ standard library

Posted: Sun Jul 22, 2007 12:49 am
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.

Re: Portable C++ standard library

Posted: Sun Jul 22, 2007 2:52 am
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?

Re: Portable C++ standard library

Posted: Sun Jul 22, 2007 3:44 am
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?

Re: Portable C++ standard library

Posted: Sun Jul 22, 2007 4:10 am
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)))?

Re: Portable C++ standard library

Posted: Sun Jul 22, 2007 4:27 pm
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.

Re: Portable C++ standard library

Posted: Mon Jul 23, 2007 6:39 am
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

Re: Portable C++ standard library

Posted: Mon Jul 23, 2007 6:58 am
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.

Posted: Mon Jul 23, 2007 7:03 am
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