Hi Brian,

greeter.go calls plugin.open and it will be work only for one sub version 
of go. If plugin and binary are made in different sub versions of go1.15 
then plugin.open will not work.  

On Monday, November 1, 2021 at 6:55:02 PM UTC+5:30 Brian Candler wrote:

> > 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/42e3d250-cb69-43b6-a297-7a56fcbe688en%40googlegroups.com.

Reply via email to