My sbt plugin is working
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Nov 11 13:26:47 UTC 2019
On 11/11/2019 12:40, Mark Hammons wrote:
> However, I was curious if it would be feasible for java.foreign to be a little
> more lenient in what it binds to. If I were able to define a method like this
> in scala:
> @NativeFunction("(i32*)v")
> def fn(i: Array[Int]): Unit
>
> and have java foreign recognize that as a valid binding
Uhm - not 100% sure about that. (i32*) means - one i32 parameter,
followed by a varargs list - e.g. in C
f(int i, ...)
So, how can you prove that an Array[Int] is the right type to hold all
of the parameters?
One thing you might want to consider actually, would be for you to use
the SystemABI API directly, to get a MethodHandle that accessed the
right native function, and maybe add a varargs adaptation on top. In
other words, I'm not sure how much of what you are doing needs
panama/foreign an the annotation stuff, and how much of what you could
do using the low level support in foreign-abi. Since that's lower level
it will give you many more options on how to surface it at the Scala level.
Maurizio
> , that would allow me
> to have a pure scala binding and make java.foreign 100% compatible with scala.
> I'm hopefuly that this is a possibility, though I'd understand if it's not
> something the project panama team wants to do or devote resources to.
>
More information about the panama-dev
mailing list