C++ applications

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
User avatar
AndreaOrru
Member
Member
Posts: 50
Joined: Fri Apr 25, 2008 2:50 pm
Location: New York

C++ applications

Post by AndreaOrru »

Hi all,

I've managed to make my 64-bit kernel able to load user-mode executables and to run them in multitasking. So far I'm using flat binaries, but I plan to shift to ELF sooner or later.

Even if I've developed it in C, I'd want to write user-space applications in C++. I've searched the wiki, but I've found only kernel-specific info.
What I'm supposed to do in order to use C++ in his full power for writing my programs? Even a simple list of the requirements would be appreciated.
Close the world, txEn eht nepO
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: C++ applications

Post by jal »

You'll need the C++ equivalent of stdlib, to start with. STL, ATL, whatnot.


JAL
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: C++ applications

Post by AJ »

Hi,

The first thing to start with is the standard library. Suppose this is newlib (see Porting Newlib), you will have to provide the same glue functions as if you were providing a C library for kernel space, except your glue functions will wrap system calls, rather than directly calling kernel functions.

Once you have a C library, porting the C++ stuff (such as libstdc++) should be relatively easy (coming from someone who hasn't actually done it... :) ).

Cheers,
Adam
User avatar
AndreaOrru
Member
Member
Posts: 50
Joined: Fri Apr 25, 2008 2:50 pm
Location: New York

Re: C++ applications

Post by AndreaOrru »

So I need full support to C, before anything else.
Thank you.
Close the world, txEn eht nepO
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: C++ applications

Post by Solar »

andreaorru wrote:So I need full support to C, before anything else.
That's effectively true for most languages, as the majority of language support runtimes / libraries is written in C. (Or C++, at which point the snake bites its own tail.)

Luckily, C doesn't require much in the way of "support". (Which is why other languages are so often implemented in it. ;-) )
Every good solution is obvious once you've found it.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: C++ applications

Post by Owen »

jal wrote:You'll need the C++ equivalent of stdlib, to start with. STL, ATL, whatnot.


JAL
ATL? The ActiveX Template Library?!

:P
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: C++ applications

Post by pcmattman »

You need libstdc++, as has already been mentioned, but you also need to have code to run the global static constructors where present and you may also need to provide a "crti" and "crtn".
So I need full support to C, before anything else.
I'd say once you can load and run an application such as bash you are ready to get libstdc++ running with some test C++ applications.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: C++ applications

Post by jal »

Owen wrote:ATL? The ActiveX Template Library?!
Without the X, actually. But you are right, I was incorrect in mentioning it.


JAL
Post Reply