EmbDev.net

Forum: ARM programming with GCC/GNU tools Coding with C++


von Michael R. (michael_rodrigues)


Rate this post
useful
not useful
Hi,

I am using the Yagarto toolchain for the AT91SAM9RL64. I am required to 
design a GUI on this chip and a GRaphical LCD. The X11R6 libraries are 
being used to handle the graphic realted parts.

My querry was,
1. could i use CPP (C++) to develop my GUI (using the same setup as 
mentioned above).

2. are there any precautions / care that i should be taking while taking 
a plunge at CPP


please reply urgent

von Guest (Guest)


Rate this post
useful
not useful
Well if there is a C++ compiler for your target platform, why not?
Usually GUI development is done with some sort of library/toolkit (on 
Standard-PCs: GTK+, Qt, MFC, ...). No idea if there is something like 
that available for the hardware you are using.

von Clifford S. (clifford)


Rate this post
useful
not useful
Michael Rodrigues wrote:
> The X11R6 libraries are
> being used to handle the graphic realted parts.
>
Will X run without an underlying Unix/Linux support? Seems a bit 
heavyweight for such a limited part. Do you have external memory 
resources?


> My querry was,
> 1. could i use CPP (C++) to develop my GUI (using the same setup as
> mentioned above).
>
You can use C++, and mix C++ and C libraries.


> 2. are there any precautions / care that i should be taking while taking
> a plunge at CPP

C++ has additional runtime set-up requirements. Your crt0.s must include 
code to invoke the constructors of statically allocated objects. I have 
seen crt0.s implementations that do not include such code so static 
objects will not be correctly initialised when main() is started.

The newlib sbrk stub must be implemented to allow the 'new' operator to 
work since it is implemented using malloc().

You may want to avoid dynamic memory allocation due to lack of 
determinism or resource, and to avoid memory fragmentation. Much of the 
standard library makes extensive use of dynamic memory, so you may wish 
to avoid that too. The STL and sting libraries add significantly to code 
size. Note also that some library calls throw exceptions. The 'new' 
operator also thors exceptions rather than returning NULL like malloc(). 
You can include <new.h> and use 'new(std::no_throw)' instead of plain 
'new'.

When mixing C and C++, be aware that C++ has different linkage 
conventions. C header files used for C++ linkage must have the extern 
"C" declaration within conditional compilation, and C++ interfaces to be 
used in C code must have been compiled with extern "C" declarations. See 
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html


Clifford

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.