Skip to content

Latest commit

 

History

History
 
 

cxx

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This is a small application to demonstrate building user level code that uses C++ and,
in particular, the standard C++ library.

Just compiling a C++ source file itself is relatively trivial. The difficulty is we
are in a non hosted environment and do not have the requisite run time support,
nor STL implementation.

The Client component demonstrates just using the C++ language, defining a simple
template, and then using regular C for actual IO. This means there are no STL
includes or additional linking required.

The Echo component attempts to use the STL that comes with GCC. Since GCC's STL
assumes the presence of its C library this does not 'just work'. We define
a helper library that consists of various defintions to bridge the gap between
the expectations of the STL and our C library. We can then add the STL location
to the include paths and link against GCCs C++ implementation libraries.

Using the STL is fairly sketchy due to our C library being fairly minimal
and not being portable to different compilers. The C++ wrapper library was the
minimal required to make the example build for a particular compiler/library
version and is by no means complete.