I did not understand the use of plugin. I can't use a plugin with different 
go versions even with minor version because plugin.open is failed. The only 
way which I found to use plugin'functions is through LD_PRELOAD.

I created a plugin using https://github.com/vladimirvivien/go-plugin-example
go build -buildmode=plugin -o eng/eng.so eng/greeter.go

Created a go binary using command:
go build -linkshared test.go

Load plugin with test binary:
export LD_PRELOAD=./eng.so; ./test
plugin addresses will be loaded into firstmoduledata structure of go 
runtime.

Created another go binary (which I want to use) using command:
go build test2.go

load plugin with test binary:
export LD_PRELOAD=./eng.so; ./test2

in this case, plugin addresses are not loaded into firstmoduledata. This is 
because addmoduledata() is not called.

I did not understand why addresses are not loaded in this case while if i 
load plugin using plugin.open then addresses are loaded for same go binary 
test2

Please suggest how to load plugin addresses into go runtime for this case. 
Can't I call addmoduledata in this case?

go versions 1.15,1.16,1.17

os - ubuntu 16

-- 
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/94f43889-5dde-42c2-a0ca-026fb288e2ban%40googlegroups.com.

Reply via email to