GUI wrapper for jextract

Nir Lisker nlisker at gmail.com
Mon Oct 3 21:19:52 UTC 2022


>
> 1 & 2 You may want to checkout https://github.com/openjdk/jextract
>
I already read everything there. I don't see the answers there.
What happens if a package name or header class name are not specified?
What does the path of -I need to point at? A folder? What file types are
accepted?
What format does a macro for -D come as? A file?


> 3. Options like -I and -l try to mimic same C compiler driver options
>
Alright.


> 4. Need to check consistency with the rest of the JDK bin tools on this.
> Btw for embedding use case, you can use ToolProvider API which jextract
> supports. No need to fork a separate process and deal with streams etc.
>
I wasn't familiar with this API; I will study it. Thanks.


> 5. Not getting your use case. "dump" is to get all symbols from header
> parsed - which you can edit and use it as argument in a later jextract
> session. That's use the intended use case.
>
The GUI wrapper reads all the symbols and allows the user to choose which
ones they want to bind to. This replaces the need for the user to modify a
text file. Think of a tree view:

[ ] myheader.h
  [ ] funcions
    [X] myfunc1
    [ ]  myfunc2
  [X] structs
    [X] mystruct1
    [X] mystruct2

This representation is easier to work with (batch selection etc,), but to
build it, a dump output is required. When the tool gets a header, it runs
--dump-includes on it, but doesn't want a file to be created, read, and
deleted. It wants the output directly "in memory".

6. jextract supports only C language - the file extensions that "clang"
> compiler accepts for C programs should work.

Alright, thanks.

- Nir

On Mon, Oct 3, 2022 at 6:34 AM Sundararajan Athijegannathan <
sundararajan.athijegannathan at oracle.com> wrote:

>
>    1. & 2 You may want to checkout https://github.com/openjdk/jextract
>    2.
>    <https://github.com/openjdk/jextract>
>    GitHub - openjdk/jextract: https://openjdk.org/projects/code-tools
>    <https://github.com/openjdk/jextract>
>    Jextract. jextract is a tool which mechanically generates Java
>    bindings from a native library headers. This tools leverages the clang C
>    API in order to parse the headers associated with a given native library,
>    and the generated Java bindings build upon the Foreign Function & Memory
>    API.The jextract tool was originally developed in the context of Project
>    Panama (and then made available in the ...
>    github.com
>
>
> 3. Options like -I and -l try to mimic same C compiler driver options
>     4. Need to check consistency with the rest of the JDK bin tools on
> this. Btw for embedding use case, you can use ToolProvider API which
> jextract supports. No need to fork a separate process and deal with streams
> etc.
>     5. Not getting your use case. "dump" is to get all symbols from header
> parsed - which you can edit and use it as argument in a later jextract
> session. That's use the intended use case.
>    6. jextract supports only C language - the file extensions that "clang"
> compiler accepts for C programs should work.
>
> -Sundar
>
> ------------------------------
> *From:* jextract-dev <jextract-dev-retn at openjdk.org> on behalf of Nir
> Lisker <nlisker at gmail.com>
> *Sent:* 03 October 2022 03:01
> *To:* jextract-dev at openjdk.org <jextract-dev at openjdk.org>
> *Subject:* GUI wrapper for jextract
>
> Hi,
>
> After a short talk with Maurizio off-list, I started making a GUI wrapper
> for jextract. I have several question/comments that came up during
> development:
>
> 1. In order to help the user give the correct inputs, is there more info
> somewhere on what each command accepts exactly? For example, what does '-I
> <path>' look for exactly in the path? What does '-D <macro>' look for?
> 2. What are the default values for options that aren't specified and have
> to have a default, like the output path, package name, and header class
> name?
> 3. I think that having a capital I and a lowercase l options is confusing
> in many fonts. Is there a reason not to use lowercase or uppercase on
> everything?
> 4. I execute jextract using a java.lang.Process object and read its output
> and error streams. I noticed that the process writes the output of
> '--version' and '--help' to the error stream, while it makes more sense to
> write them to the output stream. I'm on Windows in case it's OS dependent.
> 5. When analyzing the symbols of a header using the dump option, I need to
> read the file that jextract creates from disk and then delete it. Is there
> a way to read the jextract output directly? Either through the output
> stream, or writing to a file in memory? Dealing with disk I/O is
> cumbersome, comes with permission restrictions, and might be slow if done
> for many files in a batch.
> 6. What file formats, except for .h, can jextract expect as a target? .c?
> .hh?
>
> Thanks,
> Nir
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20221004/3da04f8a/attachment-0001.htm>


More information about the jextract-dev mailing list