I want extern "fil-C"
domenkozar
53 points
17 comments
August 13, 2026
Related Discussions
Found 5 related stories in 42.7ms across 4,128 title embeddings via pgvector HNSW
- I want extern "fil-C" ingve · 21 pts · August 14, 2026 · 99% similar
- Introduce a memory safe compilation mode inspired by Fil-C mpweiher · 71 pts · July 20, 2026 · 52% similar
- Show HN: 18KB ls alternative in no_std rust and Libc tracyspacy · 22 pts · July 15, 2026 · 43% similar
- Frame – Linux X server in Assembly guybedo · 146 pts · July 17, 2026 · 39% similar
- fx :Tiny, open, native coding agent. handfuloflight · 88 pts · August 18, 2026 · 39% similar
Discussion Highlights (8 comments)
andai
Why isn't fil-C ABI compatible with C? https://fil-c.org/runtime Apparently this was done intentionally. The rationale given is that we don't want to allow non-safe C to be used in fil-C programs. Fair enough. But why should we prevent fil-C programs to be used from Rust (or C, for that matter)? I don't understand much about compilers, but I guess allowing one would also allow the other? i.e. it's not possible to make fil-C ABI compatible with C (so that it can be more easily called), while also not letting you use call C from it?
pornel
There is a solution that Mozilla uses in prod for legacy C codecs: https://rlbox.dev/ It's not a replacement for Fil-C's role as a precise ASAN/Valgrind, but it works great if you want to call a C library without letting it freely spray caller's memory.
KateLawson
Any reason why you don't use clang's `-fbounds-safety`? It offers ABI compatibility and incremental adoption. The author of Fil-C worked on it also :-) https://clang.llvm.org/docs/BoundsSafety.html#overview
QuaternionsBhop
This would also mean that you wouldn't need unsafe{} to call into the Fil-C ffi. The majority of unsafe{} in (non pure-rust) cargo dependencies is calling C ffi. Rust + Fil-C is a great match that fills a particular niche, I'd love to see it happen.
creatonez
> [...] instead of accidentally linking ordinary C into it Out of curiosity. If you really needed to, could a language speak both the C ABI and the Fil-C ABI? As I understand Fil-C itself can't do this without having Python-like FFI overhead, but maybe a different compiler implementation could?
chubot
(revised comment) Hm on first reading I was confused by the extern "fil-c" framing -- that seems to imply a bridge between C and Fil-C, which introduces some nasty language/runtime inter-op issues. But I like this part I want a Rust FFI that speaks the Fil-C ABI. ... We could use Rust for compile-time safety and then pay a performance penalty for using C.
nnevatie
Reading this my slop-sense is tingling.
Panzerschrek
Extern "fil-C" can't be compatible with Rust code or something similar. It requires a metadata block attached to each allocation. So, if a memory block has been allocated in Rust and a pointer to it is passed to a fil-C function, it can't access it correctly. The only way to allow such cross-langauge-and-abi calls is to compile Rust code itself like fil-C, which requires doubled memory consumption, expensive runtime checks and GC overhead.