Custom exception hook in reverse C interop (#2946)

This commit is contained in:
Nikolay Igotti
2019-05-14 14:32:29 +03:00
committed by GitHub
parent e553684598
commit 019e7b1cc8
5 changed files with 43 additions and 2 deletions
@@ -5,6 +5,10 @@
#define T_(x) testlib_kref_ ## x
#define CAST(T, v) testlib_kref_ ## T { .pinned = v }
void errorHandler(const char* str) {
printf("Error handler: %s\n", str);
}
int main(void) {
T_(Singleton) singleton = __ kotlin.root.Singleton._instance();
T_(Base) base = __ kotlin.root.Base.Base();
@@ -61,6 +65,9 @@ int main(void) {
__ DisposeStablePointer(enum1.pinned);
__ DisposeStablePointer(object1.pinned);
__ kotlin.root.setCErrorHandler(&errorHandler);
__ kotlin.root.throwException();
return 0;
}