Files
rtems/testsuites/libtests/dl05/dl-o5.cpp
Chris Johns c6eead1353 libdl: Add C++ exception support to loaded modules.
This has been tested on SPARC, i386, PowerPC and ARM.

Closes #2767.
2016-12-14 09:07:16 +11:00

29 lines
682 B
C++

#include <cstdio>
#include <stdexcept>
#include "dl-load.h" /* make the symbol a C linkage */
void exception_dl(bool throw_runtime)
{
printf("exception_dl: begin\n");
try
{
printf("exception_dl: throwing...\n");
if (throw_runtime)
throw std::runtime_error("throw std::runtime_error object");
else
throw dl_test_throw_me("throw dl_test_throw_me object");
}
catch (dl_test_throw_me const& e)
{
printf("%s: caught: %s\n", __func__, e.what());
}
catch (std::exception const& e)
{
printf("%s: caught: %s\n", __func__, e.what());
}
catch (...)
{
printf("%s: caught: unknown\n", __func__);
}
printf("exception_dl: end\n");
}