savi-lang / savi

A fast language for programmers who are passionate about their craft.
BSD 3-Clause "New" or "Revised" License
157 stars 12 forks source link

Add `:foreign_name` - a way to override an `:ffi` function's C name. #319

Closed jemc closed 2 years ago

jemc commented 2 years ago

This allows us to bind to functions whose name is not practical as a function name in Savi - such as an uppercase function name, which is likely to be mistaken for a type name.

It also allows multiple FFI bindings to the same underlying C function by allowing the Savi bindings to have different names (and possibly different, but ABI-compatible type signatures) while binding to the same common C function.