Source file src/cmd/cgo/internal/testplugin/testdata/issue22295.pkg/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  //go:build ignore
     6  
     7  package main
     8  
     9  import (
    10  	"log"
    11  	"plugin"
    12  )
    13  
    14  func main() {
    15  	p, err := plugin.Open("issue.22295.so")
    16  	if err != nil {
    17  		log.Fatal(err)
    18  	}
    19  	f, err := p.Lookup("F")
    20  	if err != nil {
    21  		log.Fatal(err)
    22  	}
    23  	const want = 2503
    24  	got := f.(func() int)()
    25  	if got != want {
    26  		log.Fatalf("got %d, want %d", got, want)
    27  	}
    28  }
    29  

View as plain text