summaryrefslogtreecommitdiffstats
path: root/misc/cgo/testplugin/testdata/issue22175/main.go
blob: 9be9bab9dc35cfb2f9a8e56dc25ebb25096b5fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"fmt"
	"os"
	"plugin"
)

func main() {
	p2, err := plugin.Open("issue22175_plugin1.so")
	if err != nil {
		panic(err)
	}
	f, err := p2.Lookup("F")
	if err != nil {
		panic(err)
	}
	got := f.(func() int)()
	const want = 971
	if got != want {
		fmt.Fprintf(os.Stderr, "issue22175: F()=%d, want %d", got, want)
		os.Exit(1)
	}
}