Source file misc/cgo/testplugin/testdata/method3/main.go
1 // Copyright 2022 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 // An unexported method can be reachable from the plugin via interface 6 // when a package is shared. So it need to be live. 7 8 package main 9 10 import ( 11 "plugin" 12 13 "testplugin/method3/p" 14 ) 15 16 var i p.I 17 18 func main() { 19 pl, err := plugin.Open("method3.so") 20 if err != nil { 21 panic(err) 22 } 23 24 f, err := pl.Lookup("F") 25 if err != nil { 26 panic(err) 27 } 28 29 f.(func())() 30 31 i = p.T(123) 32 } 33