Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add java support (using JNA) #857

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Aug 30, 2024

  1. Add java support (using JNA)

    This builds on mozilla#853 and adds a new language backend capable of
    generating java bindings.
    
    The generated bindings use [JNA](https://github.com/java-native-access/jna)
    (I used the last version 5.13.0 while developping but this will probably
    work with earlier ones as well)
    
    Most of the new code lives in `bindgen/language_backend/java_jna.rs` and
    is pretty straightfowards generation as most on the complicated things were done
    in the previous refactoring.
    
    The test suite has been updated to generate and compile the bindings for
    java when running. On nice thing gained with this is the possibilibty to
    put a configuration file specific to a language alongside the stardard
    one and the test will take this one instead of the default one if it
    exists (quite a few test use the `header` config to add some more code
    inside the generated bindings, C or preprocessor code doesn't work well
    in a java source file :P)
    
    All tests are green, but that doesn't mean all the generated bindings
    are correct, some cases may fail at runtime as I didn't test all
    cases in a real program. I did however generate and use the bindings on a
    non trivial lib I'm developping and they worked as expected.
    fredszaq committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    21c47dd View commit details
    Browse the repository at this point in the history
  2. address review comments

    fredszaq committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    c238a76 View commit details
    Browse the repository at this point in the history
  3. clippy

    fredszaq committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    6a9ff03 View commit details
    Browse the repository at this point in the history