Gavin Ray
06/16/2022, 11:17 PM@CName("kt_add")
fun add(a: UInt, b: UInt): UInt = a + b
With build config:
nativeTarget.apply {
binaries {
staticLib {}
}
}
Trying to call this from a C file, like:
#include "../build/bin/native/debugStatic/libfoo_kotlin_native_api.h"
#include "stdio.h"
int main()
{
int res = kt_add(1, 2);
printf("%d\n", res);
return 0;
}
Throws a bunch of errors about what look like missing stdlib symbols 🤔
__cxa_begin_catch
, std::terminate()
, __cxa_call_unexpected
, etc
What might I be doing wrong?
I'm building with: gcc main.c ..\build\bin\native\debugStatic\libfoo_kotlin_native.a