Hello,
Stefan Eilers wrote:
>
> Hello !
>
> Does anybody has some experiences with a C++ development in LXRT ?
>
You can look how they do in RTL3.0 (http://www.fsmlabs.com).
I one word, they redefine "new" and "delete" operators in
the include/rtl_cpp.h file. They define some functions in the
example/cpp/rtl_cpp.c file to make insmod happy. Then, they
link their module with crtbegin.o and crtend.o files. At last,
they call __do_global_ctors_aux in init_module and
__do_global_dtors_aux in cleanup_module to allocate and
release static objects.
It's not so bad except that new and delete operators use
kmalloc and kfree. So, you can't create or delete objects in
RT threads (RT threads can preempt Linux while it was in the
kmalloc or kfree routine). So, you should define and use a
specific memory allocator for RT threads.
Next, C++ exceptions does not work (__throw is not defined in
crtbegin.o and crtend.o). For C++ exceptions you have to link
your application with libgcc.a. The problem is that GCC build
this library with the -fPIC option enabled (since libgcc.a may
be used to build shared libraries). So, you'll have an undefine
symbol _GLOBAL_OFFSET_TABLE_ when you'll try to load your module
with insmod.
To avoid this, you can compile a new libgcc.a with the "-fPIC"
option disabled (get a fresh copy of GCC, make ./configure, delete
all "-fPIC" options in Makefiles and then compile GCC).
I do this but now I've to write a little C++ program to verify that
all is ok (C++ constructors, destructors and exceptions).
> I would be interested in exchanging (actually only receiving ;))
> experiences !
>
Ok.
Greetings,
Joel
-- [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/