I'd like to comment on that and share my RTL/C++/STL experiences. First of all, C++ works quite flawlessly in my project ( http://www.orocos.org -- sorry, no sources yet). I wrap all malloc/free calls to kmalloc / kfree in a header file which determines if i'm compiling for the kernel or not. I do not use globals yet so don't know whether the do_global_ctors_aux() works or not (but i thought it did). Most of my symbols are resolved in rtl_cpp.c (->module ) and rtl_cpp.h ( -> include in your C++ header). I also link multiple files (classes) together with ld and the crtbegin/end stuff.
But even more, I'm almost done porting (gnu/sgi) STL to RTLinux. Only one unresolved symbol left ( the name mangled __builtin_new : __nw__FUiPv anyone know how to implement that one ?). Next will be adapting Boost C++ where they are also working on an embedable port. BTW, the missing symbol __nw__FUiPv is defined in libgcc, but that lib introduces 5 other undefined symbols, so i'll try to find how this lib is built with which function calls for implementing this symbol. I must admit that incorporating C++ in the kernel demands some not-done practices (like defining the compiler built-ins, calling the global constructors etc ) But it is in my opinion very worth the effort. Any help from the original C++/RTL porting team would also be appreciated. Peter On Tuesday 19 February 2002 15:51, you wrote: > Hi Adam, > > I am using both C and C++ in my project. I think that hte reason why more > people don't use C++ is that it is a pain in the butt to get working. Also, > C++ is a lot more liberal about things like using malloc and free when > doing object declaration in functions, etc. And malloc and RT don't really > mix too well. With RTlinux you basically have to either do kmalloc in the > init_module() or write your own memory heap allocator. Basically you use > static objects for RT. Also, C++ is pretty strict, so when writing things > like IO drivers, you have to cast the heck out of your data in order to > read and write memory and the like. I am only using C++ because of the pass > by reference operator, which I use in my API to pass a reference to and IO > variable that the function will operate on. I may use objects in future > api's but they are all functions now. I think the Real time programing > paradigm makes it more difficult to use higher level tools such as OOP jsut > because you need to be more aw! are of what is going on at a hardware > level. > > Hope this helps a bit. > > BTW, I am still having problems with my global constructors not being > initialized. I have pointers in a structure (which in C++ are objects) > which aren't getting initialized by do_global_ctors_aux() like it used to. > I am compiling two different directories and then linking their resultant > object files together at the last step. Both intermediat linking steps are > doign the $(CRTBEGIN) $(CRTEND) stuff in the C++ example but it still > doesn't work. Help!! > > ~Ken > > > > -- [rtl] --- > To unsubscribe: > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/