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.
C++ applications
- AndreaOrru
- Member
- Posts: 50
- Joined: Fri Apr 25, 2008 2:50 pm
- Location: New York
C++ applications
Close the world, txEn eht nepO
Re: C++ applications
You'll need the C++ equivalent of stdlib, to start with. STL, ATL, whatnot.
JAL
JAL
Re: C++ applications
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
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
- AndreaOrru
- Member
- Posts: 50
- Joined: Fri Apr 25, 2008 2:50 pm
- Location: New York
Re: C++ applications
So I need full support to C, before anything else.
Thank you.
Thank you.
Close the world, txEn eht nepO
Re: C++ applications
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.)andreaorru wrote:So I need full support to C, before anything else.
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.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: C++ applications
ATL? The ActiveX Template Library?!jal wrote:You'll need the C++ equivalent of stdlib, to start with. STL, ATL, whatnot.
JAL
-
- 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
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".
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.So I need full support to C, before anything else.
Re: C++ applications
Without the X, actually. But you are right, I was incorrect in mentioning it.Owen wrote:ATL? The ActiveX Template Library?!
JAL