ZILtoid1991@lemmy.world to Programmer Humor@programming.dev · 5 months agoIt's official, Rust is an anti C/C++ elitist slurlemmy.worldexternal-linkmessage-square91fedilinkarrow-up1403arrow-down130
arrow-up1373arrow-down1external-linkIt's official, Rust is an anti C/C++ elitist slurlemmy.worldZILtoid1991@lemmy.world to Programmer Humor@programming.dev · 5 months agomessage-square91fedilink
minus-squareCanadaPlus@lemmy.sdf.orglinkfedilinkarrow-up1·edit-25 months agoAre you suggesting OP write a C application and then compile it as Rust? I’m not a pro, but that sounds kind of janky.
minus-squareteolan@lemmy.worldlinkfedilinkarrow-up9·5 months agoI’m suggesting building a Rust library and exposing a C ABI. That’s what rsvg does for example.
minus-squareCanadaPlus@lemmy.sdf.orglinkfedilinkarrow-up3·edit-25 months agoOh. There’s a still Rust-y way to do this? Nevermind. OP wanted stability and predictability. I suppose we’ll see how entrenched one library can become.
minus-squareCanadaPlus@lemmy.sdf.orglinkfedilinkarrow-up4·edit-25 months agoHmm. So I guess it comes down to what OP is doing. They either want to write a Rust library, or something that uses a Rust library that may not be standardised or even exist yet. If the latter, they should stick with C.
minus-squareEphera@lemmy.mllinkfedilinkarrow-up2·5 months agoYeah, Rust has pretty good integration of it: https://doc.rust-lang.org/nomicon/ffi.html#calling-rust-code-from-c You do lose some of the Rust-y-ness, because obviously the C ABI is much more simplistic, but in terms of a stable ABI, it’s impossible to beat C.
Are you suggesting OP write a C application and then compile it as Rust? I’m not a pro, but that sounds kind of janky.
I’m suggesting building a Rust library and exposing a C ABI. That’s what rsvg does for example.
Oh. There’s a still Rust-y way to do this? Nevermind.
OP wanted stability and predictability. I suppose we’ll see how entrenched one library can become.
Removed by mod
Hmm. So I guess it comes down to what OP is doing. They either want to write a Rust library, or something that uses a Rust library that may not be standardised or even exist yet. If the latter, they should stick with C.
Removed by mod
Yeah, Rust has pretty good integration of it: https://doc.rust-lang.org/nomicon/ffi.html#calling-rust-code-from-c
You do lose some of the Rust-y-ness, because obviously the C ABI is much more simplistic, but in terms of a stable ABI, it’s impossible to beat C.