Beginner questions: Seoul, Rust, DDE, and system composition
Benjamin Lamowski
benjamin.lamowski at genode-labs.com
Thu Oct 26 17:12:45 CEST 2023
Hi Timo,
First of all sorry for my very belated reply! With the Sculpt release
out of the door, I can share a few points that came up in discussions
around Rust support.
> Since you mention this, I have been thinking about trying working on
this since I have previously written software to generate Rust bindings
for C++. Assuming that generating bindings is possible/easy, what would
still need to be done to compile/link these into native Genode
components (maybe at first with libc, and later without it)?
From my discussions at Genode Labs I have gathered that at previous
attempts, automatically generating C++ bindings for the Genode API from
other languages has not been very straightforward. Differences between C
and C++ have been handled by providing a limited(!) C API tailored to
specific use cases in dde_linux.
As I have previously written I have only worked with Rust's C FFI, but
from my understanding of cxx.rs you could feed a Genode base library C++
header you are interested in into cxx.rs and make it generate the
necessary ("Hidden C ABI") glue code.
Now in case this is not already obvious to you, it should be possible to
use our recent work on Goa support for Rust[1], and Goa should add the
necessary linker flags to link to the base library, so that the
generated C++ API interfacing code can link to it, and it should in
theory just work.
If your question was aiming more at side effects beyond ABI translation:
I'm not aware of anything else that would be needed to be done for the
general use case. In other words, if you manage to make equivalent calls
from the generated glue code, I shouldn't matter if the base ABI is
called from Rust via a backend implementation from the libc, or if it is
called directly from the C++ FFI translation code. There might be
pitfalls that are not exposed when using the Genode base API from the
Posix API, or when mixing the two (see e.g. [2]) that I'm not aware of.
All this being said, right now we don't have concrete plans to work on a
Rust API for Genode.
We feel that generating Rust bindings from our C++ ABI is a) potentially
cumbersome and b) even if successful would result in an API that is not
idiomatic and does not live up to our aspirations.
Hand-crafting an ABI on the other hand would best be done in tandem with
specific Rust components. There is currently no plan for a Rust
component inside Genode Labs but we would be interested to explore a
Rust API with a specific use case.
Best wishes,
Ben
[1] https://genodians.org/atopia/2023-10-26-a-first-complex-rust-package
[2]
https://github.com/genodelabs/genode/commit/d0a18461532cd7a5c1dadcc798bbea7da38d63f7
--
Benjamin Lamowski
Genode Labs
https://www.genode-labs.com · https://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
More information about the users
mailing list