well-typed/hs-bindgen

Generate low-level `foreign imports` for all function definitions

Opened this issue · 2 comments

This is probably relatively straight-forward, though we might already need some customization here:

For example, given

void resample(
  int32_T *res_m_num_valid_samples,
  cint16_T res_m_iq_int[30720000],
  int64_T res_m_old_rate,
  int64_T res_m_new_rate,
  cint16_T res_m_iq_resampled_int[30720000]
);

we should generate

foreign import capi safe "resample.h resample"
  c_resample ::
       Ptr Int32_T
    -> Ptr (CInt16_T)
    -> Int64_T
    -> Int64_T
    -> Ptr (CInt16_T)
    -> IO ()

Note: it might be helpful to include the C variable names (if given) as part of the haddocks we generate for the bindings.

edsko commented

Some initial steps towards this goal at #328 .