[rust-dev] How to join together C and Rust code?

Graydon Hoare graydon at mozilla.com
Mon Apr 16 11:39:23 PDT 2012


On 12-04-16 06:01 AM, Alexander Stavonin wrote:
> Is it possible to include into the one crate as Rust as C code?

Rust can call C by declaring the C functions within a suitably named
rust native module. C can call rust only by rust passing C a pointer to
a 'crust' function.

Currently the rust compiler cannot compile C code directly, it must be
compiled and linked separately. We might be changing this in the near
future, by incorporating clang into our LLVM support library, but we
have not decided to do that yet, nor started work on it. So that
feature, if it happens, is still a ways off.

-Graydon


More information about the Rust-dev mailing list