Skip to content

Commit d07a96e

Browse files
committed
v.gen.c: fix v examples/hello_world.v on FreeBSD
1 parent 8f4fe61 commit d07a96e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vlib/v/gen/c/cgen.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5879,7 +5879,8 @@ fn (mut g Gen) write_init_function() {
58795879
// ___argv is declared as voidptr here, because that unifies the windows/unix logic
58805880
g.writeln('void _vinit(int ___argc, voidptr ___argv) {')
58815881

5882-
g.writeln('#if __STDC_HOSTED__ == 1\n\tsignal(SIGSEGV, v_segmentation_fault_handler);\n#endif')
5882+
// 11 is SIGSEGV. It is hardcoded here, to avoid FreeBSD compilation errors for trivial examples.
5883+
g.writeln('#if __STDC_HOSTED__ == 1\n\tsignal(11, v_segmentation_fault_handler);\n#endif')
58835884
if g.pref.prealloc {
58845885
g.writeln('prealloc_vinit();')
58855886
}

0 commit comments

Comments
 (0)