[rust-dev] compiling Rust to C?

Cameron Zwarich zwarich at mozilla.com
Fri Jul 18 00:35:01 PDT 2014


The biggest problem would be probably be handling stack unwinding (IIRC the LLVM C backend never tried to handle this either). The only option when targeting C is to use setjmp / longjmp, but that is going to be pretty inefficient. Alternatively you could just abort instead of unwinding.

Cameron

On Jul 18, 2014, at 12:29 AM, Josh Haberman <jhaberman at gmail.com> wrote:

> Is there any prospect of compiling Rust to C anytime in the mid to near future?
> 
> This would be a really attractive option for anyone who wants to write
> in Rust, but wants the extreme portability of C.
> 
> Actually maybe I should first ask if this is actually a tractable
> problem. Are there technical reasons that would prevent compiling Rust
> into portable C?
> 
> LLVM's C Backend seems to have fallen out of maintenance -- would this
> provide the solution I am looking for, if it were maintained?
> 
> Thanks,
> Josh
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev



More information about the Rust-dev mailing list