Source file src/runtime/testdata/testprogcgo/panic.go

     1  package main
     2  
     3  // This program will crash.
     4  // We want to test unwinding from a cgo callback.
     5  
     6  /*
     7  void call_callback(void);
     8  */
     9  import "C"
    10  
    11  func init() {
    12  	register("PanicCallback", PanicCallback)
    13  }
    14  
    15  //export panic_callback
    16  func panic_callback() {
    17  	var i *int
    18  	*i = 42
    19  }
    20  
    21  func PanicCallback() {
    22  	C.call_callback()
    23  }
    24  

View as plain text