Skip to content

Instantly share code, notes, and snippets.

Emscripten as a linker for Zig and C

This shows how to build a nontrivial program using Zig+Emscripten or C+Emscripten. In both cases Emscripten is only used as a linker, that is the frontend is either zig or clang.

"Nontrivial" here means the program uses interesting Emscripten features:

  • Asyncify
  • Full GLES3 support
  • GLFW3 support
@leroycep
leroycep / forth.zig
Last active February 18, 2021 03:10 — forked from ikskuh/forth.zig
Zig Comptime Forth
const std = @import("std");
pub fn main() !void {
const argv = try std.process.argsAlloc(std.heap.page_allocator);
defer std.process.argsFree(std.heap.page_allocator, argv);
const result = forth("a b +", .{
.a = try std.fmt.parseInt(i32, argv[1], 10),
.b = try std.fmt.parseInt(i32, argv[2], 10),
});