ebitengine / purego

Apache License 2.0
1.94k stars 63 forks source link

Use Go 1.23's new structs.HostLayout #259

Open TotallyGamerJet opened 1 week ago

TotallyGamerJet commented 1 week ago

Operating System

What feature would you like to be added?

Use structs.HostLayout in all Platform specific structs

Why is this needed?

In Go 1.23, a new package and type called structs.HostLayout was added in https://github.com/golang/go/issues/66408. Adding this field to a struct instructs the compiler to guarantee the struct matches the C ABI.

We currently, rely on the fact that Go's current struct layout matches the C ABI. The following is an incomplete list of structs that must match C ABI.

As well as all the one's in struct_test.go, objc_runtime_darwin_test.go and in the examples/window platform files

This is not urgent as there is no current plan to change Go's struct layout