]> Cypherpunks.ru repositories - gostls13.git/blob - misc/cgo/testplugin/testdata/method/main.go
runtime: remove crash_cgo_test CgoRaceSignal timeout
[gostls13.git] / misc / cgo / testplugin / testdata / method / main.go
1 // Copyright 2020 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 // Issue 42579: methods of symbols exported from plugin must be live.
6
7 package main
8
9 import (
10         "plugin"
11         "reflect"
12 )
13
14 func main() {
15         p, err := plugin.Open("plugin.so")
16         if err != nil {
17                 panic(err)
18         }
19
20         x, err := p.Lookup("X")
21         if err != nil {
22                 panic(err)
23         }
24
25         reflect.ValueOf(x).Elem().MethodByName("M").Call(nil)
26 }