func main() { // Test that the signal originating in Go is handled (and recovered) by Go. if !f() { fmt.Errorf("couldn't recover from SIGSEGV in Go.") C.exit(2) } // Test that the signal originating in C is handled by C. C.sigsegv() }
func f() (ret bool) { defer func() { if recover() == nil { fmt.Errorf("ERROR: couldn't raise SIGSEGV in Go.") C.exit(2) } ret = true }() *p = 1 return false }
func Foo() { C.exit(1) }