[K/N] Added test for checking C callback set with Kotlin function throwing exception
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" void runAndCatch(void(*f)(void)) {
|
||||
try {
|
||||
f();
|
||||
} catch (...) {
|
||||
printf("CATCH IN C++!\n");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
language = C
|
||||
|
||||
---
|
||||
|
||||
void runAndCatch(void(*f)(void));
|
||||
@@ -0,0 +1,11 @@
|
||||
import kotlinx.cinterop.staticCFunction
|
||||
import cCallback.runAndCatch
|
||||
|
||||
fun throwingCallback() {
|
||||
throw IllegalStateException("Kotlin Exception!")
|
||||
}
|
||||
|
||||
|
||||
fun main() {
|
||||
runAndCatch(staticCFunction(::throwingCallback))
|
||||
}
|
||||
Reference in New Issue
Block a user