Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create C/CPP bindings #135

Open
VMatrix1900 opened this issue Dec 20, 2018 · 3 comments
Open

Create C/CPP bindings #135

VMatrix1900 opened this issue Dec 20, 2018 · 3 comments

Comments

@VMatrix1900
Copy link

Hi. Thanks for quinn. I want to call QUINN from C/CPP. How can I create a C/CPP bindings?

@Ralith
Copy link
Collaborator

Ralith commented Dec 20, 2018

You can use Rust's FFI for that. Note that the high-level quinn crate relies on tokio, which will be difficult to interoperate with from C/C++. Binding quinn-proto and using it with an existing C/C++ event loop would make more sense, but is a complicated task in its own right. Additionally, quinn-proto's interface is currently extremely unstable. While this is an interesting use-case that we'd like to support someday, it would be difficult to accomplish at present.

@VMatrix1900
Copy link
Author

VMatrix1900 commented Dec 20, 2018

@Ralith Thanks for you reply. Actually I am trying to write an video streaming application. It pulls video stream from the camera and encodes it(this part is done in CPP) then it will send the encoded data to transport protocol(like QUINN). In this case, I can use the TOKIO event loop and pull encoding data from CPP library then send this data with QUINN. This would be easier compared to call QUINN from CPP, right?

@djc
Copy link
Collaborator

djc commented Dec 20, 2018

So you have pulling video and encoding it in C++, and you want to use the transport code from Quinn in Rust. Now you have to write driver code that pushes the encoded video out over the transport. Clearly it's possible to write the driver in either C++ or Rust, but it's up to you which of those you'd prefer. You might consider which interface is more complex (the video encoding one or the network transport one) and use the language from that one, so you have less work to do in your bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants