by nickcw · 4mo ago · 0 comments
The answer is platform dependent:
Windows loads the relevant DLLs by hand and calls them. This is a well established technique in Go programs and due to the super stable DLL interface works well.
Linux has an x11 and Wayland backends and these implement (through a library) the wire protocols directly in Go which is nice and will make cross compilation and distribution easy.
macOS does appear to use cgo to access the cocoa libraries. macOS doesn't like statically linked Go programs anyway though as they don't use system name resolution so this isn't a bad compromise, but will mean macOS stuff needs to be built on macOS I think.
I didn't see Android or iOS support.
A nice innovative approach to GUI building. Since the lowest common denominator for the backends is an RGBA buffer, this will bypass all accessibility things the OS provides.
The above gleaned after a few minutes reading the source so may not be 100% accurate.
No Multiple Windows so even desktop apps will be limited to "utility-style apps".
I compiled and ran the process_monitor example on linux: it works, compiles fast and is about 10mb. Also cross-built for windows and it's 8.4mb. Can't build for macos/arm64
(Under wine the windows exe doesn't render text. weird.)
# go.hasen.dev/shirei/cocoabackend
../../../gopath/pkg/mod/go.hasen.dev/shirei@v0.5.0/cocoabackend/
perf_darwin.go:198:11: undefined: softRenderer
../../../gopath/pkg/mod/go.hasen.dev/shirei@v0.5.0/cocoabackend/
perf_darwin.go:208:22: undefined: softRenderer