Hacker News new | past | comments | ask | show | jobs | submit login

> Part of the beauty of SQLite is the single .c/.h thing.

Noting that it's not _developed_ that way. Its many files are compounded together by the build process to produce the amalgamation build. In a mixed-language project (Rust for some, C for others) a single-file distribution literally won't be possible and it will require as many toolchains to build as there are languages involved.




> a single-file distribution literally won't be possible

Actually.

You could compile the Rust into Wasm, then the Wasm into C.

Firefox did this last year [1], so the tools exist and it's neither totally impossible nor totally stupid.

The penalty is less than JITting or interpreting Wasm.

wasm2c is the tool they apparently used in 2021. [2]

[1] https://hacks.mozilla.org/2021/12/webassembly-and-back-again...

[2] https://github.com/WebAssembly/wabt/tree/main/wasm2c

> wasm2c takes a WebAssembly module and produces an equivalent C source and header.


I wonder if mrustc [0] would be sufficient to retain the amalgamated build even if Rust were adopted. The regular Rust tool chain would be needed for development still, but if simply depending on the library the Rust components could be transpiled to Cā€¦

[0] - https://github.com/thepowersgang/mrustc


TH3 requires the components to be separate for testing.

But that is not how it is meant to be used.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: