Skip to content

Instantly share code, notes, and snippets.

@LemonBoy

LemonBoy/foo.zig Secret

Created September 13, 2019 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LemonBoy/031c98e75384c1fc28a2905826a51d1b to your computer and use it in GitHub Desktop.
Save LemonBoy/031c98e75384c1fc28a2905826a51d1b to your computer and use it in GitHub Desktop.
const std = @import("std");
export fn init_fn() void {
_ = std.c.printf(c"Hello!\n");
}
export fn another_init_fn() void {
_ = std.c.printf(c"Hello again!\n");
}
export fn fini_fn() void {
_ = std.c.printf(c"Bye!\n");
}
const Fn = extern fn () void;
export const init_array linksection(".init_array") = [_]Fn{
init_fn,
another_init_fn,
};
export const fini_array linksection(".fini_array") = [_]Fn{
fini_fn,
};
pub fn main() void {
std.debug.warn("hallo from main!\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment