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

C API to libservo - not libsimpleservo #22791

Open
IngwiePhoenix opened this issue Jan 31, 2019 · 1 comment
Open

C API to libservo - not libsimpleservo #22791

IngwiePhoenix opened this issue Jan 31, 2019 · 1 comment

Comments

@IngwiePhoenix
Copy link

I have been looking a lot into FFI lately due to working on a module for a scripting language to port the dyncall library in. During that time, I had been shown a lot of Rust FFI examples, and one stood out to me in particular: https://github.com/shepmaster/rust-ffi-omnibus/blob/master/examples/objects/src/lib.rs

The methods at the bottom that implement the "wrapping" are quite generic and I would imagine generating them with a wrapper would be quite possible. This had me wondering, if it would be possible to utilize this fact to generate a C API using a macro or build step? A lot of people may use Rust by now - but many people are used to working on complex things such as browsers with C or C++. Offering a concrete C API would also open the door for any other kind of language utilizing FFI. Take for instance: Use Ruby to create a minimal web-tech based app.

My personal usecase would be to build a browser using FLTK, which is in C++. So I'd need ways to bind Servo to C, so I can utilize it from there.

This would also have to include the JS engine - when stuff like resizing the window is called, I'd have to forward that to FLTK. The easiest way would be to obtain raw JS value pointers off Servo and utilize the SpiderMonkey C API to implement window methods and other things alike.

What do you think about this? Would generating a C API like this be possible, or is Servo too complex in that regard?

@jdm
Copy link
Member

jdm commented Jan 31, 2019

Why do you want to bind libservo directly? That's unlikely to be a model that we will choose to support.

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

2 participants