Repository navigation
v0.3.0 Release Notes
go-winplugin v0.3.0
Overview
v0.3.0 is a major feature release delivering full interface support, multi-return value handling, and a completely reworked return value system that eliminates all type ambiguity present in v0.2.0.
What's New
Interface Support
Plugin functions can now accept and work with interface{}, []interface{}, and map[string]any parameters. Values are marshaled to JSON before crossing the DLL boundary and unmarshaled on the plugin side automatically.
func ProcessData(data interface{}) {
fmt.Println(data)
}loader.Call("example", "ProcessData", map[string]any{"key": "value"})
loader.Call("example", "ProcessData", []any{1, "two", true})
loader.Call("example", "ProcessData", "hello")
loader.Call("example", "ProcessData", 42)Multi-Return Values
Functions returning multiple values are now fully supported including error propagation.
func CreateUser(name string, age int) (*User, error) {
return &User{Name: name, Age: age}, nil
}result, err := loader.Call("example", "CreateUser", "Jane", 25)
// err is nil, result is map[string]any{"Name": "Jane", "Age": 25}
result, err = loader.Call("example", "CreateUserWithError", "Bad", -1)
// err.Error() == "age cannot be negative"Typed Envelope Return System
All DLL return values are now wrapped in a typed envelope:
{"type": "scalar", "value": 30}
{"type": "string", "value": "1.0.0"}
{"type": "bool", "value": true}
{"type": "error", "value": "something went wrong"}
{"type": "bytes", "value": "aGVsbG8="}
{"type": "json", "value": {"Name": "Jane", "Age": 25}}
{"type": "multi", "value": {"result0": {...}, "error": null}}This replaces the previous heuristic-based approach (0xFFFF threshold, looksLikeError) with deterministic decoding.
New Supported Return Types
[]byteerror(single return)int64,uint64,float32- All struct and
*structtypes via JSON
Breaking Changes
Callreturn type changed fromuintptrtoany
Update your call sites from:
result, err := loader.Call("example", "Execute", uintptr(10), uintptr(20))
// result was uintptr
fmt.Println(result) // 30to:
result, err := loader.Call("example", "Execute", uintptr(10), uintptr(20))
// result is now any (int64 for integer returns)
fmt.Println(result) // 30
if val, ok := result.(int64); ok {
fmt.Println(val + 1)
}Bug Fixes
- Fixed CGO preprocessor crash
expected ';', found 'return'in generated wrapper code for multi-return functions — caused by inline IIFEs that exceeded column limits in CGo's C preprocessor - Fixed raw pointer values being returned to callers for string/struct/multi returns
- Fixed multi-return error detection incorrectly requiring error to be the sole key
Installation
go get github.com/RamanSharma100/go-winplugin@v0.3.0Full Changelog
See [CHANGELOG.md](CHANGELOG.md) for the complete list of changes.