Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Pass FnPtr params as ffi.Callback #29

Open
bengreenier opened this issue Jan 6, 2022 · 1 comment
Open

Pass FnPtr params as ffi.Callback #29

bengreenier opened this issue Jan 6, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@bengreenier
Copy link
Contributor

Sometimes we may wish to use ffi.Callback to represent a function pointer that's being passed to a native function as a parameter. Today, these types get mapped as ffi.Function which isn't compatible. We should consider how to support a typed solution that allows either:

  • Select ffi.Function or ffi.Callback via clangffi flags or other user config (ideally selection occurs at a function level)
  • Provide a typing that allows for either, and let the caller decide
@bengreenier bengreenier added the enhancement New feature or request label Jan 6, 2022
@bengreenier
Copy link
Contributor Author

as a workaround today, one may pass a ffi.Callback() anywhere a ffi.Function() is taken as a param, but they must cast it to any.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant