import com.sun.jna.{Library, Native, Platform, Structure, Pointer}
import scala.collection.JavaConverters._
class Test(var t:Int, var s:Int) extends Structure { override def getFieldOrder = List("t","s").asJava }
compiles fine, but at runtime throws with
var t = new Test(1,2)
java.lang.Error: Structure.getFieldOrder() on class Test returns names ([s, t]) which do not match declared field names ([])
Looking at jna-4.1.0 source code, and the offending fragment, everything should to be fine (similar steps executed from REPL yields list of fields), yet it is not :/
I would appreciate if someone could help me deal with this error...
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
for (int i=0;i < fields.length;i++) {int modifiers = fields[i].getModifiers();if (Modifier.isStatic(modifiers)|| !Modifier.isPublic(modifiers))continue;classFields.add(fields[i]);}...so this won't work with Scala... It seems that the only reasonable way to work with native code would to be to create a java/JNA wrapper and call it from Scala.Thanks for your help,Bolek.