ffig icon indicating copy to clipboard operation
ffig copied to clipboard

Generate Rust bindings

Open jbcoe opened this issue 9 years ago • 8 comments

Add a template to ffig/templates and modify cmake/ffig.cmake so that Rust bindings can be generated.

jbcoe avatar Feb 05 '17 11:02 jbcoe

that will get us to the top of hackernews!!111

petr-tik avatar Feb 06 '17 17:02 petr-tik

@petr-tik are you tempted to try this?

jbcoe avatar Feb 07 '17 10:02 jbcoe

Sorry, that was a sarky comment - I don't know enough rust to even take a stab and I want to concentrate on documenting the code and getting a web version out asap

I know someone, who might be though.

petr-tik avatar Feb 07 '17 10:02 petr-tik

@petr I found that writing the template was a fun way to learn ruby. I Should probably raise a ticket to improve the ruby bindings.

jbcoe avatar Feb 07 '17 14:02 jbcoe

ok, let's discuss this tonight

petr-tik avatar Feb 07 '17 15:02 petr-tik

As discussed, I will pick this up, but it will take me a while (not the priority atm imho) and it's likely to be very basic

petr-tik avatar Feb 08 '17 11:02 petr-tik

Maybe useful:

  • http://rustbyexample.com/fn/methods.html
  • http://jinja.pocoo.org/docs/2.9/templates/
  • https://gitlab.com/Fraser999/Rust-From-CXX/tree/master

I'll happily merge a rust template that just created a file with classes with the right names.

jbcoe avatar Feb 08 '17 22:02 jbcoe

I'm wondering if we should take an approach of hooking up Rust's BindGen to generate a rust crate from ffig's generated *_c.h file.

value added by ffig over raw BindGen might be that ffig has a defined way of coping with C++ exceptions.

Separately, there is also a concerning statement in the BindGen documentation thus:

* Automatically calling copy and/or move constructors or destructors. Supporting this isn't possible with Rust's move semantics.

Any thoughts/comments/discussion welcomed

philipcraig avatar Jan 04 '19 11:01 philipcraig