> My question was how to load plugin address in go runtime using 
LD_PRELOAD. I am using LD_PRELOAD because plug.open is failed. Is there any 
other solution?

When I tried it, I didn't need to set any environment variables (and 
certainly no LD_XXX variables).  Follow this tutorial:
https://medium.com/learning-the-go-programming-language/writing-modular-go-programs-with-plugins-ec46381ee1a9

It works fine for me:

ubuntu@builder:~/go-plugin-example$ *cat /etc/lsb-release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
ubuntu@builder:~/go-plugin-example$ *ls*
LICENSE  README.md  chi  eng  greeter.go  swe
ubuntu@builder:~/go-plugin-example$ *go version*
go version go1.16.6 linux/amd64
ubuntu@builder:~/go-plugin-example$ *go build -buildmode=plugin -o 
eng/eng.so eng/greeter.go*
ubuntu@builder:~/go-plugin-example$ *go run greeter.go english*
Hello Universe
ubuntu@builder:~/go-plugin-example$

If you're still using Ubuntu 16, note that it went obsolete nearly a year 
ago (unless you're paying for extended maintenance).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/5242ea82-de60-4243-a9e9-c30888f20497n%40googlegroups.com.

Reply via email to