Repository navigation
Releases
v0.3.0 - interface support, multi-return values, typed envelope return system
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.
v0.2.0 - Some updates
go-winplugin v0.2.0
Added
- Multi-file plugin support
- Package-wide function analysis
- Struct type detection
- Struct pointer detection
- Plugin sandbox validation
- Symbol caching
- Additional compiler and integration tests
Changed
- Package analysis now scans entire packages
- Improved wrapper generation
- Improved DLL loading workflow
- Improved workspace generation
- Improved symbol resolution performance
Fixed
- Cross-file function resolution
- DLL loading path issues
- Wrapper generation inconsistencies
- Multi-file plugin compilation issues
Security
Blocked imports:
- os
- os/exec
- syscall
- unsafe
Notes
Struct support currently includes:
- Struct detection
- Struct pointer detection
- Validation support
- Wrapper generation compatibility
Interface marshalling and advanced runtime validation are planned for future releases.
v0.1.1 - Patch Updates
v0.1.1 -Patch Updates
Added
- Windows CI support via
windows-latestGitHub Actions runner - Explicit Go test workflow separation
- Environment variable support for
GOOS=windowsandGOARCH=amd64
Changed
- Improved CI pipeline structure (separated build/test jobs conceptually)
- Updated Go version handling to support
1.26.2
Fixed
- Go module version format issues (
go.modvalidation) - Call of function from another file in plugin
- Temporary folder handling improvements (preparation for cleanup support)
Notes
- This release improves stability for Windows plugin development workflow
v0.1.0 - Initial Release
go-winplugin v0.1.0
Windows-compatible Go plugin system using DLLs and CGO.
Features
- Dynamic DLL generation
- Runtime symbol loading
- Automatic wrapper generation
- Function signature parsing
- Cross-workspace isolated builds
- UUID-based temp workspaces
- Windows plugin support without native Go plugins
- CGO shared library runtime
- Exported function validation
- Runtime DLL loading and invocation
Supported Types
Current support includes:
- int
- string
- void functions
Example
loader, _ := winplugin.NewLoader("./example")
loader.Build("plugin.go")
loader.Call("Execute")Why?
Go plugins are not officially supported on Windows.
This project provides a DLL-based alternative using:
- c-shared
- CGO
- generated wrappers
- runtime symbol loading
Status
Early alpha release.
APIs may change before v1.0.0.
5. Verify Install Works
VERY important.
Test from a totally separate folder:
mkdir test-plugin
cd test-plugin
go mod init test-plugin
go get github.com/RamanSharma100/go-winplugin@v0.1.0Then verify import/build.