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

decide intended usage #2

Open
3b opened this issue Jan 1, 2024 · 0 comments
Open

decide intended usage #2

3b opened this issue Jan 1, 2024 · 0 comments

Comments

@3b
Copy link
Owner

3b commented Jan 1, 2024

a few combinations to consider

  • full "projection" (nice wrappers as main API, hide details where possible, etc)
    The metadata provides lots of useful things to allow automatic generation of "nice" APIs:
    • which function to use to release various return values
    • which arguments are reserved and should be 0 (so can be skipped in wrapped API)
    • which argument/field shows size or count of elements in an array
    • fields that must be initialized to size of struct
  • low-level direct C-like bindings (pointers, manual resource management etc)
    Easier to generate, but harder to use. Good enough for a lot of simple things though. Probably can get close enough to the 'nice' api for a lot of slightly more complicated things by generating with-foo macros.

and orthogonal to that:

  • Generate entire FFI at once (probably as a bunch of separate systems so people don't have to download everything at once).
    Probably easier, since it doesn't require the parser/generator code to be reliable enough for general use, but also leads to shipping a big pile of untested code, and not sure how much overhead compiling/loading unused FFI definitions would add.
  • API to let users generate just the FFI they need and put it directly into their project.
    More work since the parser/generator needs to be more reliable and more configurable. Savings from generating just what you need might in practice be lost if dependencies also needed the same thing and you ended up with multiple copies (or more work to avoid the duplication).
@3b 3b mentioned this issue Jan 1, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant