occa
occa copied to clipboard
Exceptions and extern "C"
It seems throwing exceptions from functions marked 'extern "C"' is undefined behaviour.
This causes some tests that use ASSERT_THROW to fail when compiled with the PGI (20.1-0) compiler, since the exception is not propagated/caught properly anymore and std::terminate is called. For testing purposes I looked at the c-device test and moved occaCreateDevice out of the 'extern "C"' part of the code and then the test worked correctly.
Any thoughts on a proper way to fix this? It seems kind of involved to do it nicely.