Hello! I'm having issues with cinterop on iOS. Can...
# multiplatform
a
Hello! I'm having issues with cinterop on iOS. Can anyone please help me? I've the following struct in C, that is compiled to an iOS XCFramework.
Copy code
struct LogMessage {
    unsigned int level;
    char message[1024];
};
The struct is imported as:
Copy code
@kotlinx.cinterop.ExperimentalForeignApi public final expect class LogMessage public constructor(rawPtr: kotlin.native.internal.NativePtr /* from: kotlinx.cinterop.NativePtr */) : kotlinx.cinterop.CStructVar {
    @kotlin.Deprecated public expect companion object : kotlinx.cinterop.CStructVar.Type {
    }

    public expect final var level: kotlin.UInt /* from: cocoapods.SDK.LogLevel */ /* compiled code */

    public expect final val message: kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVarOf<kotlin.Byte>> /* from: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.ByteVarOf<kotlin.Byte> /* from: kotlinx.cinterop.ByteVar */> */ /* compiled code */
}
Now I'm trying to create an instance of the LogMessage struct in Kotlin side. The problem is that the message property is declared as val, so there's no way to set it. Do you know how to solve this? Thank you in advance