Replies: 4 comments 3 replies
-
|
I was thinking again about this lately, and another question I have is what should we be able to do with Rust. I don't know how the Python bindings works, but when multiple language are supported on the same platform, should each language be able to talk to each other ? As of know in Java for example you can call C++ and C++ can call Java. Does the Python implementation support calling both Java and C++ or just C++ ? Should a Rust binding be able to call/be called from every language ? I guess that would be possible by always going through C++: Java -> C++ -> Rust and C++ -> Rust. I should have a look at the Python bindings to see what they are actually doing ;) |
Beta Was this translation helpful? Give feedback.
-
|
As in #53 mentioned, Python uses FFI. So for FFI the same code could be an option. The C binding currently run just under the Python name, but we will extract that in future. Of course, since you use the C Interface, live time handling has to be taken care for in the implemented language, in the djinni generated code of the target language. |
Beta Was this translation helpful? Give feedback.
-
|
Here is an interesting project that does that: https://cxx.rs/ by using a Rust dsl to provide definition of the C++ interface and macros that generates Rust and C++ glue code, kind of the same way as Djinni does but using Rust macros. I should definitively have a look at that. Adding a generator to Djinni to generate the Rust idl should be straight forward as a first step, even though djinni should probably be able to generate the glue code directly. |
Beta Was this translation helpful? Give feedback.
-
|
Seeing how Rust has become viable for cross-platform code, I would 100% support this idea to have the option to use either Rust or C++ as the cross-platform code implementation. I haven't coded in Rust before, but I do plan to use Rust cross-platform for a future project and would love to volunteer. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Imported from #53
Is there some interest in adding Rust support ? I have some part of my C++ code bases that I'd like to migrate to Rust and I think that Djinni and its interfaces would make a good and easy target for interop. What do you think ?
Just some random idea, I'm not an expert in Djinni and even less in Rust but maybe first adding a C generator that creates an FFI api. Then use that code to present the C++ implementation to the equivalent Rust interface and vice-versa. There is the problem of somehow respecting the std::shared_ptr<> lifetimes and probably a tons of other things I did not think about but I just want to spark a discussion and check for interest in this feature.
Beta Was this translation helpful? Give feedback.
All reactions