RainwayApp / node-clangffi

Generate Typescript FFI bindings for C/C++ libraries using libclang and ffi-napi.
MIT License
7 stars 1 forks source link

Pass FnPtr params as ffi.Callback #29

Open bengreenier opened 2 years ago

bengreenier commented 2 years ago

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:

bengreenier commented 2 years ago

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.