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

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
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

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

Post 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
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

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

Post 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.
Da_Maestro
Member
Member
Posts: 144
Joined: Tue Oct 26, 2004 11:00 pm
Location: Australia

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

Post 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.
Two things are infinite: The universe and human stupidity. But I'm not quite sure about the universe.
--- Albert Einstein
Post Reply