Source file misc/cgo/testplugin/testdata/issue22175/main.go
1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 "os" 10 "plugin" 11 ) 12 13 func main() { 14 p2, err := plugin.Open("issue22175_plugin1.so") 15 if err != nil { 16 panic(err) 17 } 18 f, err := p2.Lookup("F") 19 if err != nil { 20 panic(err) 21 } 22 got := f.(func() int)() 23 const want = 971 24 if got != want { 25 fmt.Fprintf(os.Stderr, "issue22175: F()=%d, want %d", got, want) 26 os.Exit(1) 27 } 28 } 29