#HSLIDE
Gildas Chabot, leboncoin
#HSLIDE
#HSLIDE
dlfcn.h
(dynamic linking) with cgo
#HSLIDE
#HSLIDE
-buildmode=plugin
build option.so
#HSLIDE
Open(path string) (*Plugin, error)
(p *Plugin) Lookup(symName string) (Symbol, error)
Plugin
Symbol
#HSLIDE
p, err := plugin.Open("plugin.so")
fs, err := p.Lookup("Transform")
f, ok := fs.(func(image.Image) image.Image)
vs, err := p.Lookup("Priority")
v, ok = *vs.(*int)
#HSLIDE
#HSLIDE
#HSLIDE
panic
?#HSLIDE
.so
loaded in Go
#HSLIDE
Questions?
Find the code and slides on Github: https://github.com/GildasCh/go-plugins-demo