all: bug fix: relative paths for dlopen didn't work on macOS Sonoma

Closes #2732
This commit is contained in:
Hajime Hoshi 2023-08-26 13:04:21 +09:00
parent 592d6c57b7
commit dec08b9e4e
6 changed files with 7 additions and 7 deletions

View File

@ -59,7 +59,7 @@ var (
)
func initializeCF() error {
corefoundation, err := purego.Dlopen("CoreFoundation.framework/CoreFoundation", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
corefoundation, err := purego.Dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
if err != nil {
return err
}

View File

@ -87,7 +87,7 @@ type (
type _IOHIDDeviceCallback func(context unsafe.Pointer, result _IOReturn, sender unsafe.Pointer, device _IOHIDDeviceRef)
func initializeIOKit() error {
iokit, err := purego.Dlopen("IOKit.framework/IOKit", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
iokit, err := purego.Dlopen("/System/Library/Frameworks/IOKit.framework/IOKit", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
if err != nil {
return err
}

View File

@ -52,7 +52,7 @@ type MetalLayer struct {
//
// Reference: https://developer.apple.com/documentation/quartzcore/cametallayer.
func MakeMetalLayer() (MetalLayer, error) {
coreGraphics, err := purego.Dlopen("CoreGraphics.framework/CoreGraphics", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
coreGraphics, err := purego.Dlopen("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
if err != nil {
return MetalLayer{}, err
}

View File

@ -35,7 +35,7 @@ func init() {
//go:cgo_import_dynamic _ _ "Metal.framework/Metal"
// It is also necessary for CoreGraphics to be linked
_, _ = purego.Dlopen("CoreGraphics.framework/CoreGraphics", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
_, _ = purego.Dlopen("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
}
func Example_listDevices() {

View File

@ -569,7 +569,7 @@ var (
//
// Reference: https://developer.apple.com/documentation/metal/1433401-mtlcreatesystemdefaultdevice.
func CreateSystemDefaultDevice() (Device, error) {
metal, err := purego.Dlopen("Metal.framework/Metal", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
metal, err := purego.Dlopen("/System/Library/Frameworks/Metal.framework/Metal", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
if err != nil {
return Device{}, err
}

View File

@ -25,14 +25,14 @@ var (
)
func (c *defaultContext) init() error {
lib, errGLES := purego.Dlopen("OpenGLES.framework/OpenGLES", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
lib, errGLES := purego.Dlopen("/System/Library/Frameworks/OpenGLES.framework/OpenGLES", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
if errGLES == nil {
c.isES = true
opengl = lib
return nil
}
lib, errGL := purego.Dlopen("OpenGL.framework/OpenGL", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
lib, errGL := purego.Dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
if errGL == nil {
opengl = lib
return nil