Page 1 of 1

How to make parts of my OS in C++ and the rest in C

Posted: Fri Mar 31, 2006 12:00 am
by earlz
I already have my low level parts of my OS in C and will make everything lowlevel in C because its easier but I want to make some parts of my OS in C++. Well what do I need for C++ to work fully

Re: How to make parts of my OS in C++ and the rest in C

Posted: Sat Apr 01, 2006 12:00 am
by Hery
I am not sure but I think that you sould try it:
1. Compile C code to, for example, file ccode.o
2. Compile C++ code to, for example, file cppcode.o
3. Using LD link files ccode.o and cppcode.o
You can compile both C code and C++ code using gcc.

Re: How to make parts of my OS in C++ and the rest in C

Posted: Sat Apr 01, 2006 12:00 am
by Da_Maestro
To use C++ code in your kernel you will need to build some support code, namely the code which initialises the contructors for the global objects in your kernel. Oh, and try to avoid run-time-typing of variables, though inheritance is still allowed.