Debian Codegraph @

libgo/go/runtime/testdata/testwinlib/main.go

raw
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 //export CallMeBack
15 func CallMeBack(callback C.callmeBackFunc) {
16 C.bridgeCallback(callback)
17 }
18
19 // Dummy is called by the C code before registering the exception/continue handlers simulating a debugger.
20 // This makes sure that the Go runtime's lastcontinuehandler is reached before the C continue handler and thus,
21 // validate that it does not crash the program before another handler could take an action.
22 // The idea here is to reproduce what happens when you attach a debugger to a running program.
23 // It also simulate the behavior of the .Net debugger, which register its exception/continue handlers lazily.
24 //export Dummy
25 func Dummy() int {
26 return 42
27 }
28
29 func main() {}