Finished part 1 of the Wayland McWayface tutorial of Drew DeVault - Issue with spi toolprovider interface and jextract

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Sun Feb 24 00:30:03 UTC 2019


On 23/02/2019 23:26, Mark Hammons wrote:
> Hi all,
>
> I've finally written a working implementation of the first part of 
> Drew DeVault's tutorial, and I wanted to put it here first to get your 
> feedback
>
> https://github.com/markehammons/Wayland-McWayface_JVM-edition/tree/Part1
Thanks! I'll look into that in more details.
>
> I've tried using the new forked scopes in the recent release, but I 
> frequently hit issues of being unable to use pointers I need to use. 
> This usually happens with the allocated callbacks, so I assume I could 
> merge said callback's pointers into the scope of what they're being 
> assigned to, but I haven't tried that yet. The struct issue I reported 
> earlier continues to plague me, and has resulted in me writing a few 
> workaround classes in java. Also, I allocated a c_array to communicate 
> with a function call but is there no way to just pass in a regular 
> java array at this time?

So:

1) I'd like to know more about the issues with pointer/callback - e.g. 
what issues have you encountered; if it mostly happens with callbacks, 
there could be some lurking issue with scoping of these callback pointers?

2) the struct issue has been fixed - you'll see that situation improved 
on the next binary build

3) if you want to pass an array to a native function you have to create 
a native array; while in the future we might provide 'civilization' 
options to emit signatures closer to what a Java developer would expect, 
that's not the goal now. You should be able to allocate a native array 
from Java array with relative ease.

>
> Finally, and this is the biggest issue, I cannot get jextract working 
> via the spi.ToolProvider interface. If you look at the build.sbt in 
> the root of my project, I have defined a task binding for jextract to 
> be called and configured by sbt without having to call outside of the 
> JVM. When I tried this with jlink 
> (https://gist.github.com/markehammons/42d75709e060625f1a663b442842b461) 
> it worked fine, and spi.ToolProvider says it's finding jextract, 
> jextract is just not doing anything. I'm guessing the jextract tool 
> isn't hooked into ToolProvider yet?

This surprises me - I'll leave this to Sundar - but I seem to recall 
that jextract was indeed hooked up and that we're even using that 
capability for testing? The following was pushed last year

http://cr.openjdk.java.net/~sundar/jextract_tool_provider_testng/webrev.00/raw_files/new/test/jdk/com/sun/tools/jextract/JextractToolProviderTest.java

Maurizio


>
> Anyway, tell me if you have any suggestions to improve my usage of the 
> foreign APIs in this project. And especially tell me if I can get 
> jextract working through the ToolProvider interface. I'd love to start 
> developing sbt and mill plugins for projects to bind native code with, 
> but I can't till that gets worked out.
>
> Thanks,
>
> Mark
>
>


More information about the panama-dev mailing list