I've noticed a difference in behavior between Linu...
# kotlin-native
j
I've noticed a difference in behavior between Linux and Windows with throwing an exception in a
staticCFunction
called from C code. On Windows, the exception is propagated and I can catch it in Kotlin with a try/catch surrounding the call to the C code that calls the
staticCFunction
. But on Linux, this exception is instead caught by the underlying C code and returned in the error code from the C function as an "unknown C++ exception". I'm trying to determine if this difference in behavior is due to Kotlin/Native, the C library, or possibly the GCC/MinGW compilers. I'd like to have access to the original exception to keep the behavior consistent between the two platforms. Is there a difference between the way Kotlin/Native exceptions behave on Windows vs Linux?
I suppose as a workaround, I could perform the try/catch within the
staticCFunction
and save a global reference to a caught exception from within the
staticCFunction
to then access from outside the call if the "unknown C++ exception" error is encountered.