Source file src/cmd/cgo/internal/testplugin/testdata/issue19418/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 p, err := plugin.Open("plugin.so") 15 if err != nil { 16 panic(err) 17 } 18 19 val, err := p.Lookup("Val") 20 if err != nil { 21 panic(err) 22 } 23 got := *val.(*string) 24 const want = "linkstr" 25 if got != want { 26 fmt.Fprintf(os.Stderr, "issue19418 value is %q, want %q\n", got, want) 27 os.Exit(2) 28 } 29 } 30