Open
Description
Scala code will not compile if there are structs that are passed by value.
Example:
struct MyStruct {
int a;
};
struct OtherStruct {
struct MyStruct s;
};
This Scala code will not compile:
@native.link("Lib")
@native.extern
object Lib {
type struct_MyStruct = native.CStruct1[native.CInt]
type struct_OtherStruct = native.CStruct1[struct_MyStruct]
}
import Lib._
object LibMembersHelpers {
implicit class struct_OtherStruct_ops(val p: native.Ptr[struct_OtherStruct]) extends AnyVal {
def s: struct_MyStruct = !p._1 // error
def s_=(value: struct_MyStruct):Unit = !p._1 = value // error
}
}
One possible solution - remove declarations that use structs by value.
Another - generate C code that converts struct to a pointer