Hotplugin
golang plugin framework for hot update
Install / Use
/learn @letiantech/HotpluginREADME
hotplugin
golang plugin framework for hot update, go version >= 1.8
usage
- get hotplugin
go get github.com/letiantech/hotplugin
- write a plugin with Load, Unload and other functions like this
//testplugin.go
package main
import (
"fmt"
"log"
)
const (
pluginName = "testplugin"
pluginVersion = 0x00010000
)
func Load(register func(name string, version uint64) error) error {
err := register(pluginName, pluginVersion)
if err != nil {
log.Println(err.Error())
return err
}
log.Println("loading test plugin")
return nil
}
func Unload() error {
fmt.Printf("unload %s, version: 0x%x\n", pluginName, pluginVersion)
return nil
}
func Test(data string) string {
return "hello " + data
}
- build your plugin
go build -buildmode=plugin ./testplugin.go
-
save your testplugin.so to /path/of/plugin/dir
-
write main.go like this
//main.go
package main
import (
"fmt"
"github.com/letiantech/hotplugin"
)
func main() {
options := hotplugin.ManagerOptions{
Dir: "./",
Suffix: ".so",
}
hotplugin.StartManager(options)
result := hotplugin.Call("testplugin", "Test", "my world")
fmt.Println(result...)
}
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
352.0kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
