New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use pluginpath in golang 1.13 or golang 1.14 #39142
Comments
Could you provide an example of the code that produced the error? |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
// test/plugins/helloworld/main.go
package main
import (
"fmt"
)
func init() {
fmt.Println("plugin hello has been loaded")
}
func Hello(name string) {
fmt.Println("Hello " + name)
} // test/main.go
package main
import (
"fmt"
"plugin"
)
func getPluginMethod(pluginPath, method string) (interface{}, error) {
plugin, err := plugin.Open(pluginPath)
if nil != err {
return nil, err
}
return plugin.Lookup(method)
}
func main() {
fmt.Println("begin main")
helloSymbol, err := getPluginMethod("./lib/hello.so", "Hello")
if nil != err {
fmt.Println(err.Error())
return
}
hello, ok := helloSymbol.(func(name string))
if !ok {
fmt.Println("hello must be func(string)")
return
}
hello("World")
}
|
@ztgameming @folivora-ice did you solve this problem, How can I solve it? |
@ztgameming @folivora-ice did you solve this problem, How can I solve it? |
The same question in go version go1.17.9 darwin/amd64 |
dont use pluginpath option, just copy code to different directory. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: