ebitengine / purego

Apache License 2.0
2.15k stars 68 forks source link

enable `RegisterFunc` and `RegisterLibFunc` for non-supported architectures #230

Closed hajimehoshi closed 5 months ago

hajimehoshi commented 5 months ago

Now RegisterFunc and RegisterLibFunc don't work on non-supported architectures (e.g. Linux 386). If they could be available even with Cgo, it would be nice since we could share the same code using PureGo for any architectures.

There is an actual use case: I tried to fix github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl/gl to use PureGo for Linux, but failed due to this error:

panic: purego: unknown GOARCH (386)

goroutine 1 [running]:
github.com/ebitengine/purego.numOfIntegerRegisters(...)
    /home/runner/go/pkg/mod/github.com/ebitengine/purego@v0.8.0-alpha.0.20240407111646-0e6302132b78/func.go:422
github.com/ebitengine/purego.RegisterFunc({0x839c5a0, 0x86c4bdc}, 0xeac822b0)
    /home/runner/go/pkg/mod/github.com/ebitengine/purego@v0.8.0-alpha.0.20240407111646-0e6302132b78/func.go:132 +0x144
github.com/ebitengine/purego.init.0()
    /home/runner/go/pkg/mod/github.com/ebitengine/purego@v0.8.0-alpha.0.20240407111646-0e6302132b78/dlfcn.go:22 +0x3b