SMRTR ProgrammingSep 18, 2024Daily.dev

Compile and run C in JavaScript

SMRTR summary

Bun, a JavaScript runtime, now supports compiling and running native C code directly from JavaScript. This new feature, introduced in version 1.1.28, offers an alternative to existing methods like N-API addons and WebAssembly. It uses TinyCC to compile C programs in-memory, with fast compilation times (around 5ms) and low overhead (2ns per call). This approach allows developers to use C libraries and system APIs from JavaScript without separate build steps or complex setups. It's particularly useful for tasks like video conversion with ffmpeg or accessing system-specific features like the macOS Keychain API.

SMRTR provides this summary for quick context. The original article belongs to Daily.dev.

Read the original article
SMRTR Programming

Get the next batch of curated summaries in your inbox.

This archive is built from SMRTR newsletter summaries. Subscribe for hand-picked stories without the extra noise.