Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8356234

jextract C++ support feature request

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • tools
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Java 22+

      A DESCRIPTION OF THE PROBLEM :
      Thank you for bringing jextract to life and continue improving it.

      It seems, these days for C++ libraries it is more important to provide Python bindings and not C. Examples are PCL, Open3D, etc. Which is very disturbing, as jextract currently targets C only. It would be nice so that jextract could help in creating bindings to C++, at least to some degree like it is done in Rust with [rust-bindgen](https://github.com/rust-lang/rust-bindgen).

      May be the first step in this direction can be integrating Maurizio branch and make sure that when jextract encounters some problematic C++ code it does not crash completely and just skips it instead. It should try to continue to generate what it can. Because as of now jextract behaves like "all or nothing" and in C++ case (with [Maurizio PoC](https://github.com/openjdk/jextract/compare/panama...mcimadamore:jextract:cxx?expand=1) branch) users end up with "nothing" most of the time. This is especially relevant when jextract goes to stdlib code as there it encounters many problematic C++ code and crashes:

      java.lang.IllegalArgumentException: Invalid cursor kind
      at org.openjdk.jextract@21/org.openjdk.jextract.impl.TreeMaker.checkCursorAny(Unknown Source)

      At least it can try to generate some "stubs" in this case rather than crashing? Users can then manually define such stubs later.

      I see there are already issues to address C++, like CODETOOLS-7903783 but I don't see any "official" feature request for C++ support. For example as of now I could not find any documentation covering how to use jextract with C++.



            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: