C++ standard library support
C++ standard library support
Are there any tutorials on how to enable support for the C++ standard library in my kernel?
-
- 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++ standard library support
You'd have to have a complete port of the C library first (and I mean complete) first. Not to mention the fact that the C++ STL is apparently a nightmare to port.
- AndrewAPrice
- Member
- Posts: 2309
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Try STLport, or Boost C++ Libraries. Although Boost technically isn't a C++ STL implementation, it's considered an extension of it and (I think) it can be used without an STL library.AusZero wrote:Are there any other libraries that I can use with my operating system?
EDIT: I didn't see "in my kernel". It's still possible. I've ported some things like malloc and strings to my kernel. Just replace the system calls with function calls!
My OS is Perception.
Re: C++ standard library support
Well, if you follow the instructions at OS Specific Toolchain you'll end up with a libsupc++, libstdc++ and an include directory with all the stl stuff in. There are obviously a lot of dependencies on libgcc (which you also get for free) and libc (which you get, but it is tailored for userspace, so writing a smaller kernel version might make more sense). I have never tried stl in a kernel, but can't see why it shouldn't work (as long as you implement malloc, strcpy etc), but I can vouch for the functioning of libsupc++, including exceptions and rtti, all within kernel space within a few lines of startup (although you need a simple malloc, e.g a stack-based one, before your virtual memory manager starts).AusZero wrote:Are there any tutorials on how to enable support for the C++ standard library in my kernel?
Regards,
John.