HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
emscripten-core
emscripten
C++2011–2026
emscripten-core / emscripten

emscripten

Emscripten: An LLVM-to-WebAssembly Compiler

123Distinct people
148Mentions
0Explicit recommenders
27.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Emscripten: An LLVM-to-WebAssembly Compiler

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 6:01:08 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year148 dated mentions

Observed mentions: 2011-04-16 12:05:53 UTC to 2026-06-13 18:10:02 UTC.

051015202011-01-01 00:00:00 UTC to 2012-01-01 00:00:00 UTC (exclusive): 13 mentions; 3 submissions, 10 comments20112012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 20 mentions; 4 submissions, 16 comments2013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 21 mentions; 0 submissions, 21 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 13 mentions; 1 submissions, 12 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 16 mentions; 2 submissions, 14 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 10 mentions; 1 submissions, 9 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 17 mentions; 1 submissions, 16 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 9 mentions; 0 submissions, 9 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20112011-01-01 00:00:00 UTC2012-01-01 00:00:00 UTC13310
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC20416
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC21021
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC13112
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC16214
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC1019
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC17116
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC202
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC303
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC413
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC615
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC303
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC505
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC909
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC303

What Hacker News says

9 sources
A bit OT here, but oh well Would hardened_malloc or llvm scudo be useful in a WASM runtime (given that WASM doesn't have an MMU)? https://www.google.com/search?q=would+hardened_malloc+be+use... Emscripten handles malloc and free with dlmalloc, emmalloc, mimalloc, emcc your_code.c -s 'MALLOC="emmalloc"' -o your_code.html how to add "hardened_malloc" memory allocator support to emscripten for WASM? https://www.google.com/search?q=how+to+add+%22hardened_mallo... "Import custom memory manager?" · Issue #24851 · emscripten-core/emscripten https://github.com/emscripten-core/emscripten/issues/24851 Just learned about Cage: Cage does Hardware-Accelerated Safe WebAssembly (WASM) with LLVM with support for ARM64 Memory Tagging Extension (MTE) and Pointer Authentication (PAC) memory safety features. "Cage: Hardware-Accelerated Safe WebAssembly"
Read the rest
In Ghostty compiled to WASM with xterm.js API compatibility
Regarding C - yes, multiple stacks should be supported, and I literally opened a PR to add coroutine support based on JSPI to emscripten: https://github.com/emscripten-core/emscripten/pull/25111 JSPI-based coroutines are much faster than the old Asyncify ones (my demo shows that). As for your core message - I'm just the user, but if Google engineers were able to implement that, then it is possible to implement that securely. I remember Google engineers arguing with Apple engineers in GH issues, but I'm not on that level, I just see that JSPI is already implemented in Chrome, so you can't tell me it's not possible.
In WASM 3.0 Completed
Emscripten has a handy tool called "Embind" for binding JavaScript/TypeScript and C/C++/whatever code. It's underappreciated and not well documented all in one place, but here is a soup-to-nuts summary. Emscripten + Embind allow you to subclass and implement C++ interfaces in TypeScript, and easily call back and forth, even pass typed function pointers back and forth, using them to call C++ from TypeScript and TypeScript from C++! Embind: https://emscripten.org/docs/porting/connecting_cpp_and_javas... Interacting with Code: https://emscripten.org/docs/porting/connecting_cpp_and_javas... Embind's bind.cpp plumbing: https://github.com/emscripten-core/emscripten/blob/main/syst... C Emscripten macros (like EM_ASM_): https://livebook.manning.com/book/webassembly-in-action/c-em... Emscripten’s embind: https://web.dev/articles/embind I'm using i
Read the rest
t for the WASM version of Micropolis (open source SimCity). The idea is to be able to cleanly separate the C++ simulator from the JS/HTML/WebGL user interface, and also make plugin zones and robots (like the monster or tornado or train) by subclassing C++ interface and classes in type safe TypeScript! emscripten.cpp binds the C++ classes and interfaces and structs to JavaScript using the magic plumbing in "#include <emscripten/bind.h>". There is an art to coming up with an elegant interface at the right level of granularity that passes parameters efficiently (using zero-copy shared memory when possible, i.e. C++ SimCity Tiles <=> JS WebGL Buffers for the shader that draws the tiles) -- see the comments in the file about that): emscripten.cpp: https://github.com/SimHacker/MicropolisCore/blob/main/Microp... /** * @file emscripten.cpp * @brief Emscripten bindings for Micropolis game engine. * * This file contains Emscripten bindings that allow the Micropolis * (open-source version of SimCity) game engine to be used in a web * environment. It utilizes Emscripten's Embind feature to expose C++ * classes, functions, enums, and data structures to JavaScript, * enabling the Micropolis game engine to be controlled and interacted * with through a web interface. This includes key functionalities * such as simulation control, game state management, map * manipulation, and event handling. The binding includes only * essential elements for gameplay, omitting low-level rendering and * platform-specific code. */ [...] //////////////////////////////////////////////////////////////////////// // This file uses emscripten's embind to bind C++ classes, // C structures, functions, enums, and contents into JavaScript, // so you can even subclass C++ classes in JavaScript, // for implementing plugins and user interfaces. // // Wrapping the entire Micropolis class from the Micropolis (open-source // version of SimCity) code into Emscripten for JavaScript access is a // large and complex task, mainly due to the size and complexity of the // class. The class encompasses almost every aspect of the simulation, // including map generation, simulation logic, user interface // interactions, and more. [...] class_<Callback>("Callback") .function("autoGoto", &Callback::autoGoto, allow_raw_pointers()) [...] Here's the WebGL tile renderer that draws the tiles directly out of a Uint16Array pointing into WASM memory: https://github.com/SimHacker/MicropolisCore/blob/main/microp... The corresponding C++ source and header and TypeScript files define the callback interface and plumbing: callback.h defines the abstract Callback interface, as well as a ConsoleCallback interface that just logs to the JS console, for debugging: callback.h: https://github.com/SimHacker/MicropolisCore/blob/main/Microp... /** * @file callback.h * @brief Interface for callbacks in the Micropolis game engine. * * This file defines the Callback class, which serves as an interface * for various callbacks used in the Micropolis game engine. These * callbacks cover a wide range of functionalities including UI * updates, game state changes, sound effects, simulation events, and * more. The methods in this class are virtual and intended to be * implemented by the game's frontend to interact with the user * interface and handle game events. */ class Callback { public: virtual ~Callback() {} virtual void autoGoto(Micropolis *micropolis, emscripten::val callbackVal, int x, int y, std::string message) = 0; [...] callback.cpp implements just the concrete ConsoleCallback interface in C++ with "EM_ASM_" glue to call out to JavaScript to simply log the parameters of each call: callback.cpp: https://github.com/SimHacker/MicropolisCore/blob/main/Microp... /** * @file callback.cpp * @brief Implementation of the Callback interface for Micropolis game * engine. * * This file provides the implementation of the Callback class defined * in callback.h. It includes a series of methods that are called by * the Micropolis game engine to interact with the user interface. * These methods include functionalities like logging actions, * updating game states, and responding to user actions. The use of * EM_ASM macros indicates direct interaction with JavaScript, typical * in a web environment using Emscripten. */ js_callback.h contains an implementation of the Callback interface that caches a "emscripten::val jsCallback" (an enscripten value reference to a JS object that implements the interface), and uses jsCallback.call to make calls to JavaScript: js_callback.h: https://github.com/SimHacker/MicropolisCore/blob/main/Microp... #include <emscripten/val.h> #include "callback.h" class JSCallback : public Callback { public: explicit JSCallback(emscripten::val jsCallback) : Callback(), jsCallback(jsCallback) {} // Implement all pure virtual functions from Callback void autoGoto(Micropolis *micropolis, emscripten::val callbackVal, int x, int y, std::string message) override { jsCallback.call<void>("autoGoto", emscripten::val(micropolis), callbackVal, x, y, message); } [...] private: emscripten::val jsCallback; }; Then emscripten/embind generates a TypeScript file that defines the JS side of things: micropolisengine.d.ts: https://github.com/SimHacker/MicropolisCore/blob/main/microp... // TypeScript bindings for emscripten-generated code. Automatically generated at compile time. [...] export interface Callback { autoGoto(_0: Micropolis, _1: any, _2: number, _3: number, _4: EmbindString): void; [...] export type MainModule = WasmModule & typeof RuntimeExports & EmbindModule; export default function MainModuleFactory (options?: unknown): Promise<MainModule>; Then you can import that TypeScript interface (using a weird "<reference path=" thing I don't quite understand but is necessary), and implement it in nice clean safe TypeScript: https://github.com/SimHacker/MicropolisCore/blob/main/microp... /// <reference path="../types/micropolisengine.d.ts" /> import type { Micropolis, JSCallback } from '../types/micropolisengine.d.js'; // Micropolis Callback Interface Implementation export class MicropolisCallbackLog implements JSCallback { verbose: boolean = false; autoGoto(micropolis: Micropolis, callbackVal: any, x: number, y: number, message: string): void { console.log('MicropolisCallbackLog: autoGoto:', 'x:', x, 'y:', y, 'message:', message); } It's all nice and type safe, and Doxygen will even generate documentation for you: https://micropolisweb.com/doc/classJSCallback.html And it even works, and it's pretty fast! (Type "9" to go super fast, but for the love of god DO NOT PRESS THE SPACE BAR!!!) https://micropolisweb.com
In When Is WebAssembly Going to Get DOM Support?
I think WebAssembly could be amazing for taking chunks of existing programs and making them super portable (and sandboxed!), and it kind of is already, but boy, I was pretty surprised to just recently realize it's not really as polished or complete as I think you'd hope for this use case. If you want to build something like libpng (or a myriad of other C libraries,) you need setjmp/longjmp. Not really a huge problem: Emscripten can handle this, it just needs a tiny bit of help via host functions. You can also use Wasm Exception Handling instead, in which case you don't need any hacks on the host side. So far this sounds pretty good, but actually it isn't, because: - Wasm Exception Handling is still not part of the standard. They are supported by browsers and runtimes based on browsers, but they are unsupported by lots of other runtimes (W
Read the rest
azero doesn't seem to support them, for example.) - When you're using Emscripten outside of a browser, you can use the Emscripten method for sjlj support even in a "standalone" build, calling into some simple host functions, which is handy. The problem is... standalone builds with Emscripten don't really work that well. A lot of the syscalls don't really go anywhere: https://github.com/emscripten-core/emscripten/blob/main/syst... A non-standalone build is possible, but even though Emscripten does use WASI for many things automatically, a lot of host support is required to make this work properly, so outside of a browser environment I reckon this will take a lot of work, and it seems also that it will be hard to properly implement those functions in many of the standalone Wasm runtimes. You can compile with a Clang/WASI toolchain instead, which will implement much more of the syscalls via WASI, but I don't think this supports the Esmcripten method for handling Wasm Exception Handling, which means you need to have a runtime with Wasm Exception Handling support. I guess the Clang/WASI toolchain is doing the right thing here, but it's still somewhat frustrating that Wasm Exception Handling is still not a part of the standard or many of the non-browser runtimes.
In WebAssembly: Yes, but for What?
> Will the Wasm GC pave the way to having native object references to JS objects/classes AFAIK that was already possible via 'WASM reference types': https://caniuse.com/wasm-reference-types Seeing that this is not yet used by Emscripten JS shims I wonder if there are downsides which prevent its use for something like WebGL objects, or whether just nobody got around yet rewriting the Emscripten shims to externrefs. PS: probably not worth the effort (see last comment: https://github.com/emscripten-core/emscripten/issues/20021)
In WASM GC isn't ready for realtime graphics
The best solution is to reduce the amount of alloc/free calls in your code, then you can just as well use a slow-and-small allocator like emmalloc since allocator overhead doesn't matter anymore: https://github.com/emscripten-core/emscripten/blob/main/syst... (e.g. if memory management overhead shows up in the profiler, the proper solution is not to go looking for a faster general-purpose allocator, but to reduce the amount of calls into the allocator)
In WASM GC isn't ready for realtime graphics

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.