On Mon, 29 Jan 2024, "Dr. Arne Babenhauserheide" <arne_...@web.de> wrote:
[...] > Ideally with a fast Scheme-to-Rust-to-Scheme interface (similar to the > native C arrays numpy exposes to C that allow getting the speed of C). See <https://doc.rust-lang.org/nomicon/ffi.html>. There is many path to do this. The main issue is the calling convention. Rust functions that you want binding for must follow the C calling convention by using `extern "C"'. Otherwise, the calling convention of the compiler is used (AFAIK, Rust does not define a calling convention). You can then simply use the system foreign interface as usual as if the Rust functions were C functions. There are others thing to consider. Structures in Rust must have the attribute `#[repr(C)]' to follow the C ABI for structure members layout. Otherwise, the compiler is free to re-order members. Then there is callbacks .. and other things .. The above link gives comments on all of this but not much details. Hope that helps. -- Olivier Dion oldiob.dev