scala-native / scala-native-bindgen

Scala Native Binding Generator

Home Page:https://scala-native.github.io/scala-native-bindgen/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Skip functions that pass structs or arrays by value

kornilova203 opened this issue · comments

Compilation of generated code causes scala.scalanative.util.UnreachableException

Compilation of following function will cause exception:

def acceptStruct(arr: CStruct1[CInt]): Unit = // ...

But these example will not:

def acceptArray(arr: CArray[CInt, Nat._5]): Unit = // ...

If we try to call this function then compiler will throw UnsupportedException: can't cast from Array(Int,5) to Array(Class(Top(java.lang.Object)),0)

Also native functions may return structs but exception is thrown when we try to compile code that uses returned value