Josef Reidinger
2014-01-08 16:15:23 UTC
Hi,
I would like to point to interesting library for C extension to ruby.
short:
just look at https://github.com/ffi/ffi how you can do quick and easy C
bindings from ruby code ( so no C code needed ). For C++ you should
look at https://github.com/jasonroelofs/rbplusplus
long story:
We discussing on lunch about various quality of C bindings ( hating
perl C bindings :) ) and we remembered that duncan do something with
it, but I cannot remember more details. Martin think that FFI is about
making C api better but need to write in C. So I look into it how it
works and are quite surprised that
1) you write it in ruby
2) is really straight forward
3) doesn't work well C++ ( let me fix it if I understand it wrong ).
But I found that exists also library for it rb++
https://github.com/jasonroelofs/rbplusplus
I think it is much better option then generating interface with Swig
which is quite buggy and limited, especially for complex C++ and resul
is not nice ( often object hierarchy is broken ).
Josef
I would like to point to interesting library for C extension to ruby.
short:
just look at https://github.com/ffi/ffi how you can do quick and easy C
bindings from ruby code ( so no C code needed ). For C++ you should
look at https://github.com/jasonroelofs/rbplusplus
long story:
We discussing on lunch about various quality of C bindings ( hating
perl C bindings :) ) and we remembered that duncan do something with
it, but I cannot remember more details. Martin think that FFI is about
making C api better but need to write in C. So I look into it how it
works and are quite surprised that
1) you write it in ruby
2) is really straight forward
3) doesn't work well C++ ( let me fix it if I understand it wrong ).
But I found that exists also library for it rb++
https://github.com/jasonroelofs/rbplusplus
I think it is much better option then generating interface with Swig
which is quite buggy and limited, especially for complex C++ and resul
is not nice ( often object hierarchy is broken ).
Josef