My sbt plugin is working
Mark Hammons
mark.hammons at inaf.cnrs-gif.fr
Mon Nov 11 14:24:52 UTC 2019
Hi Maurizio,
I'm not sure I fully understand. SystemABI resides in jdk.internal.foreign,
and trying to access it gives me an IllegalAccessError. Is there an API I'm
missing under java.foreign to do this? And it's not very clear how I'd use
SystemABI to look up the right function and get a method handle. Also, if it
requires poking around in java internals, won't that make my library fairly
difficult to use as the users would probably have to add special jvm options
to override the IllegalAccessError?
Thanks,
Mark
On Monday, November 11, 2019 2:26:47 PM CET Maurizio Cimadamore wrote:
> 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