It turns out that C# always expects bools to be passed as 4-byte
ints, which matches the classic C definition (which was usually
typedef'd to int) but is platform-dependent. On some platforms we
were building with 1-byte ints which led to bools getting mangled
when passing them to C#.
Luckily we already have bools passed to C# separated from bools
passed to Rust, so we can simply redefine `jboolean` to `int32_t`.
return res;
}
-typedef bool jboolean;
+// The C# Bool marshalling is defined as 4 bytes, but the size of bool is platform-dependent
+typedef int32_t jboolean;
int64_t CS_LDK_allocate_buffer(int64_t len) {
return (int64_t)MALLOC(len, "C#-requested buffer");