well-typed / hs-bindgen

Automatically generate Haskell bindings from C header files
13 stars 0 forks source link

Support `static inline` functions #90

Open edsko opened 3 weeks ago

edsko commented 3 weeks ago

Some libraries have static inline functions in C headers, intended to be inlined at all use sites. We need to generate CApiFFI bindings for these (to get a wrapper we can link to). See https://www.greenend.org.uk/rjk/tech/inline.html and https://gcc.gnu.org/onlinedocs/gcc/Inline.html for some background information.

A good example to test against is xxHash .

edsko commented 3 weeks ago

(Such functions are declared as static inline so that the various .c files in which they are included don't result in duplicated symbols; see also https://stackoverflow.com/a/47821267/742991).