github.com/mtsmfm/go/src@v0.0.0-20221020090648-44bdcb9f8fde/runtime/testdata/testwinlibthrow/main.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  	"syscall"
     6  )
     7  
     8  func main() {
     9  	dll := syscall.MustLoadDLL("veh.dll")
    10  	RaiseExcept := dll.MustFindProc("RaiseExcept")
    11  	RaiseNoExcept := dll.MustFindProc("RaiseNoExcept")
    12  	ThreadRaiseExcept := dll.MustFindProc("ThreadRaiseExcept")
    13  	ThreadRaiseNoExcept := dll.MustFindProc("ThreadRaiseNoExcept")
    14  
    15  	thread := len(os.Args) > 1 && os.Args[1] == "thread"
    16  	if !thread {
    17  		RaiseExcept.Call()
    18  		RaiseNoExcept.Call()
    19  	} else {
    20  		ThreadRaiseExcept.Call()
    21  		ThreadRaiseNoExcept.Call()
    22  	}
    23  }