occa icon indicating copy to clipboard operation
occa copied to clipboard

Exceptions and extern "C"

Open SFrijters opened this issue 5 years ago • 0 comments

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.

SFrijters avatar Jun 16 '20 15:06 SFrijters