Source file misc/cgo/testplugin/testdata/issue18584/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 "plugin"
     8  
     9  func main() {
    10  	p, err := plugin.Open("plugin.so")
    11  	if err != nil {
    12  		panic(err)
    13  	}
    14  
    15  	sym, err := p.Lookup("G")
    16  	if err != nil {
    17  		panic(err)
    18  	}
    19  	g := sym.(func() bool)
    20  	if !g() {
    21  		panic("expected types to match, Issue #18584")
    22  	}
    23  }
    24  

View as plain text