Open GoogleCodeExporter opened 9 years ago
That's basically what JNA does, so you could use that if you wish.
The problem with that approach is that it duplicates all data, which gets out
of sync if we don't sync them explicitly. There is no foolproof way to sync
them automatically unfortunately.
BTW, if you are interested in a shorter syntax, you should look into Scala.
It's possible to shorten statements like
public native int data(); public native void data(int data);
to just
@native var data: Int
if we extend the meaning of the `@native` annotation to variables that is.
Would that satisfy your needs?
Original comment by samuel.a...@gmail.com
on 1 Nov 2012 at 1:45
I thought about sync issue too.
But maybe it wouldn't be a problem for read-only or write-only?
I didn't know much about JNA, Scalar. (JavaCPP is the first jni tool for
me.:) )
Thank you for info.
Original comment by noranb...@gmail.com
on 1 Nov 2012 at 2:00
It could be interesting if we do not keep a native structure on the heap. That
is, it gets recreated every time we call a function. We wouldn't even need any
special annotation then. On function call, JavaCPP would basically create a
"struct" on the stack, copy all the fields, and that's it. It would work very
much like the arguments themselves actually.
I think it's a good feature! Good idea. It would require some amount work, so
I'm not sure that I'll be working on it myself soon though...
Original comment by samuel.a...@gmail.com
on 1 Nov 2012 at 2:53
Yes, that's what I meant.
This will be useful and intuitive for primitive type member field. (Maybe
same can be applied to Pointer type)
Of course overhead for every copy is on user's own.
I like your renamed summary. :)
Original comment by noranb...@gmail.com
on 1 Nov 2012 at 3:04
Original issue reported on code.google.com by
noranb...@gmail.com
on 1 Nov 2012 at 12:52