From d07a96ede88456aaa1fd12c4161e4ad83957184a Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 28 Sep 2021 12:00:34 +0300 Subject: [PATCH] v.gen.c: fix `v examples/hello_world.v` on FreeBSD --- vlib/v/gen/c/cgen.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index b1b9746d46..c8b561413d 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -5879,7 +5879,8 @@ fn (mut g Gen) write_init_function() { // ___argv is declared as voidptr here, because that unifies the windows/unix logic g.writeln('void _vinit(int ___argc, voidptr ___argv) {') - g.writeln('#if __STDC_HOSTED__ == 1\n\tsignal(SIGSEGV, v_segmentation_fault_handler);\n#endif') + // 11 is SIGSEGV. It is hardcoded here, to avoid FreeBSD compilation errors for trivial examples. + g.writeln('#if __STDC_HOSTED__ == 1\n\tsignal(11, v_segmentation_fault_handler);\n#endif') if g.pref.prealloc { g.writeln('prealloc_vinit();') }