On Tue, Oct 1, 2013 at 3:25 PM, Jason E. Aten <j.e.a...@gmail.com> wrote:
> On Tue, Oct 1, 2013 at 12:21 PM, Daniel Micay <danielmi...@gmail.com>wrote: > >> A minimal application now looks like this: >> >>> >>> #[no_std]; >>> >>> #[start] >>> fn main(_: int, _: **u8) -> int { 0 } >>> >>> There's no need for zero.rs anymore since you're now able to define the >>> `#[lang]` items on an as-needed basis. You can even compile mixed >>> C/C++/Rust programs with link-time optimization by using `clang`. >>> >>> It's a pain not having the standard library, but with a few intrinsics >>> wrapped it's still a nicer language than C. >>> >> > Whoa. Interesting. The mixed C++/Rust part is quite intriguing. Could you > demonstrate how you would mix C++ and Rust with clang? > > You use `rustc` to output LLVM IR (with --emit-llvm) and then compile with `clang -flto -O3 foo.cc foo.bc` (you need a version close to Rust's LLVM, 3.3 won't understand the readnone/readonly parameter attributes). If you're calling the Rust functions from C++ or the C++ functions from Rust you do need to mark them as extern "C". It means you can have inlining and whole program optimization between Rust and C/C++ though.
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev