...

Source file src/runtime/testdata/testwinlib/main.go

Documentation: runtime/testdata/testwinlib

     1  //go:build windows && cgo
     2  // +build windows,cgo
     3  
     4  package main
     5  
     6  // #include <windows.h>
     7  // typedef void(*callmeBackFunc)();
     8  // static void bridgeCallback(callmeBackFunc callback) {
     9  //	callback();
    10  //}
    11  import "C"
    12  
    13  // CallMeBack call backs C code.
    14  //
    15  //export CallMeBack
    16  func CallMeBack(callback C.callmeBackFunc) {
    17  	C.bridgeCallback(callback)
    18  }
    19  
    20  // Dummy is called by the C code before registering the exception/continue handlers simulating a debugger.
    21  // This makes sure that the Go runtime's lastcontinuehandler is reached before the C continue handler and thus,
    22  // validate that it does not crash the program before another handler could take an action.
    23  // The idea here is to reproduce what happens when you attach a debugger to a running program.
    24  // It also simulate the behavior of the .Net debugger, which register its exception/continue handlers lazily.
    25  //
    26  //export Dummy
    27  func Dummy() int {
    28  	return 42
    29  }
    30  
    31  func main() {}
    32  

View as plain text