Hi
after the short discussion about c++ in kernel modules i
browsed the archive and tried again and managed to compile and
insert a module coded in c++.
but it was not that simple - at least on my box and i am not really
pleased with that version. i had to patch at least one rtl header
file and had to undefine several macros before including some of the
c++ header files. thus i am _very_ unsure if my c++-modules will
behave i would like them to do ... unfortunately i didn't know
excatly what i undefined or commented out 8->. probably some of you
can help on that:
* i implemented new/delete as proposed in the list
* i included all kernel/rtl headers in extern "C" { #incl.. }
* i call the __do_glabal_Xtors_aux() funcs in init/cleanup module
* i declared init/cleanup module as extern
* i removed the -O2 flag from rtl.mk !! <sigh>
(solved the "can't find version information ..." error on
insertion)
with that i got a "insertable" module but without any real c++ code
and c++ includes inside.
when i tried to include some c++ or even rtl headers i ran into
several pages of compiler error/warnings:
* in /usr/src/rtlinux/linux/include/linux/list.h there was a
variable named "new"
--> i used #define new _new just before the c-includes and
"undefed" it again before my c++ includes.
* in /usr/include/g++/std/stl_allocate.h there is a
enum-hack: ...
enum { __ALIGN=8; } <-- first error
enum { __something_i_dont_know=16; }
...
got the compiler error: parse error before "." ...
after searching the includes i found that __ALIGN is defined as
[.align,7,0x90] or similar somewhere earlier.
* in /usr/include/g++/std/stl_iterator.h there is a class member of
some iterator type named "current". compiler error "no member
named current: ..."
--> i undefed __ALIGN and current just before the includes
containing the errors - everything was good.
* in /usr/src/rtlinux/include/rtl_time.h handling of the errno and
__errno_location caused hard problems. there was some former
declaration of those symbols in /usr/include/errno.h.
dependent on __KERNEL__ there is some very strange (to me)
declaration which i can't remember exactly right now.
#ifdef __KERNEL__
extern int * (*__errno_location());
#define errno ...
#else
extern int errno ??
#endif
--> i found no other way as patching the source file, including
#ifdef __KERNEL__
#ifdef __DO_KERNELCPP__
...
#endif
#else /* __KERNEL__ */
and defining it in my kernel++.h file.
oh that is quite a lot ...
can anybody tell me if i did some severe changes to my system sources
with the above means or is it ok for me. besides that i don't like
the fact that i patched a system file directly.
as anybody experience in using the stl or similar classes in rt?
CU
mailto:[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/rtlinux/