-
-
Save kbd/c08a9acbf65fa8a9be2e31fecdc36119 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const stdout = std.io.getStdOut().writer(); | |
const print = stdout.print; | |
const Allocator = std.mem.Allocator; | |
pub var A: *Allocator = undefined; // allocator | |
fn hello() !void { | |
try print("hello", .{}); | |
} | |
fn buildFuncMap() type { | |
return std.StringArrayHashMap(*const @TypeOf(hello)).init(A); | |
} | |
pub fn main() !void { | |
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
defer arena.deinit(); | |
A = &arena.allocator; | |
var funcmap = buildFuncMap(); | |
} |
Author
kbd
commented
Jan 4, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment