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

Automatic generation of FFI wrappers #131

Open
andrewvyrros opened this issue Jun 17, 2021 · 1 comment
Open

Automatic generation of FFI wrappers #131

andrewvyrros opened this issue Jun 17, 2021 · 1 comment

Comments

@andrewvyrros
Copy link
Member

andrewvyrros commented Jun 17, 2021

Currently, when adding a component, we need to manually create the FFI wrapper function and its associated bootstrap.json metadata. It'd be fantastic if this could be done automatically from the underlying Rust function in a build script. But this is hard!

There are a couple of ways that this might work:

  • Proc macros invoked directly on the functions in opendp to generate the wrappers. This has the downside of introducing (generated) unsafe code into core.
  • A build script in opendp-ffi that parses the functions in opendp to generate the wrappers. This would require a little more plumbing, but the code would be the same (presumably using the syn crate), and it avoids the unsafe issue.

One of the main stumbling blocks is wrappers requiring complex dispatch on type. The macros in dispatch.rs only handle one level of indirection, so this means implementing multiple nesting monomorphize() functions.

An intermediate step towards this could be #42.

@andrewvyrros andrewvyrros added this to Needs Discussion in OpenDP Development via automation Jun 17, 2021
@andrewvyrros andrewvyrros changed the title Automatic generation of FFI wrappers and metadata Automatic generation of FFI wrappers Jun 22, 2021
@andrewvyrros andrewvyrros moved this from Future to 0.3.0-M2 in OpenDP Library Milestones Jun 25, 2021
@andrewvyrros andrewvyrros moved this from Needs Discussion to Up Next in OpenDP Development Oct 12, 2021
@raprasad
Copy link
Member

raprasad commented Feb 29, 2024

Large project w/ low payoff in regard to use cases.

(Polars will significantly reduce FFI code which may make this more plausible in the future.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort 3 - Large 🍰 Used for estimation
Projects
Development

Successfully merging a pull request may close this issue.

2 participants