• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2021 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// A type can be passed to a plugin and converted to interface
6// there. So its methods need to be live.
7
8package main
9
10import (
11	"plugin"
12
13	"testplugin/method2/p"
14)
15
16var t p.T
17
18type I interface{ M() }
19
20func main() {
21	pl, err := plugin.Open("method2.so")
22	if err != nil {
23		panic(err)
24	}
25
26	f, err := pl.Lookup("F")
27	if err != nil {
28		panic(err)
29	}
30
31	f.(func(p.T) interface{})(t).(I).M()
32}
33