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

jextract should generate a static forwarder class

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • repo-panama
    • repo-panama
    • tools
    • None
    • generic
    • generic

      jextract generates one interface per C header file and the user has to bind the interface using Libraries.bind method to get an implementation.

      This does not feel natural to access C shared objects from Java code via an interface. jextract should generate a static forwarder class per C header. The static forwarder class will hold a library interface reference as a static private field and call Libraries.bind to initialize it (in <clinit> method).

      User can use "import static" to import static forwarder and access C api with more natural way. No bind, no interaceObj.func() calls - just straight func() calls.

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: