diff options
author | Christian Cunningham <cc@localhost> | 2022-03-30 16:22:09 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-03-30 16:22:09 -0700 |
commit | 72a403ce29627ad6fb603c366b239ba8c9e5131e (patch) | |
tree | f8b0e6cc520b64ccee98f8c852da12ea318aab1c /usr/cxx.cpp | |
parent | 16348742989a94b63f278fb4c43e09ef994353f8 (diff) |
Allow C++ user code
Diffstat (limited to 'usr/cxx.cpp')
-rw-r--r-- | usr/cxx.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/usr/cxx.cpp b/usr/cxx.cpp new file mode 100644 index 0000000..0c41cca --- /dev/null +++ b/usr/cxx.cpp @@ -0,0 +1,24 @@ +extern "C" { +#include <drivers/uart.h> +}; + +class TestClass { + public: + unsigned long value; + TestClass(unsigned long v) { + value = v; + } + void increment() { + value++; + } + void increment(unsigned long v) { + value += v; + } +}; + +extern "C" void cpp_demo(unsigned long v) +{ + TestClass tc = TestClass(v); + tc.increment(); + uart_hexn(tc.value); +} |