mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
all: use RTLD_LAZY in dlopen for darwin (#2453)
dlopen requires either RTLD_LAZY or RTLD_NOW but there was neither. Updates #1162
This commit is contained in:
parent
072e91d67f
commit
56ec19caa1
@ -50,7 +50,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
corefoundation = purego.Dlopen("CoreFoundation.framework/CoreFoundation", purego.RTLD_GLOBAL)
|
corefoundation = purego.Dlopen("CoreFoundation.framework/CoreFoundation", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
procCFNumberCreate = purego.Dlsym(corefoundation, "CFNumberCreate")
|
procCFNumberCreate = purego.Dlsym(corefoundation, "CFNumberCreate")
|
||||||
procCFNumberGetValue = purego.Dlsym(corefoundation, "CFNumberGetValue")
|
procCFNumberGetValue = purego.Dlsym(corefoundation, "CFNumberGetValue")
|
||||||
procCFArrayCreate = purego.Dlsym(corefoundation, "CFArrayCreate")
|
procCFArrayCreate = purego.Dlsym(corefoundation, "CFArrayCreate")
|
||||||
|
@ -85,7 +85,7 @@ type _IOHIDElementType uint32
|
|||||||
type _IOHIDDeviceCallback func(context unsafe.Pointer, result _IOReturn, sender unsafe.Pointer, device _IOHIDDeviceRef)
|
type _IOHIDDeviceCallback func(context unsafe.Pointer, result _IOReturn, sender unsafe.Pointer, device _IOHIDDeviceRef)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
iokit = purego.Dlopen("IOKit.framework/IOKit", purego.RTLD_GLOBAL)
|
iokit = purego.Dlopen("IOKit.framework/IOKit", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
|
|
||||||
procIOHIDElementGetTypeID = purego.Dlsym(iokit, "IOHIDElementGetTypeID")
|
procIOHIDElementGetTypeID = purego.Dlsym(iokit, "IOHIDElementGetTypeID")
|
||||||
procIOHIDManagerCreate = purego.Dlsym(iokit, "IOHIDManagerCreate")
|
procIOHIDManagerCreate = purego.Dlsym(iokit, "IOHIDManagerCreate")
|
||||||
|
@ -49,7 +49,7 @@ type MetalLayer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
coreGraphics = purego.Dlopen("/System/Library/Frameworks/CoreGraphics.framework/Versions/Current/CoreGraphics", purego.RTLD_GLOBAL)
|
coreGraphics = purego.Dlopen("/System/Library/Frameworks/CoreGraphics.framework/Versions/Current/CoreGraphics", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
_CGColorSpaceCreateWithName = purego.Dlsym(coreGraphics, "CGColorSpaceCreateWithName")
|
_CGColorSpaceCreateWithName = purego.Dlsym(coreGraphics, "CGColorSpaceCreateWithName")
|
||||||
_CGColorSpaceRelease = purego.Dlsym(coreGraphics, "CGColorSpaceRelease")
|
_CGColorSpaceRelease = purego.Dlsym(coreGraphics, "CGColorSpaceRelease")
|
||||||
kCGColorSpaceDisplayP3 = purego.Dlsym(coreGraphics, "kCGColorSpaceDisplayP3")
|
kCGColorSpaceDisplayP3 = purego.Dlsym(coreGraphics, "kCGColorSpaceDisplayP3")
|
||||||
|
@ -35,7 +35,7 @@ func init() {
|
|||||||
//go:cgo_import_dynamic _ _ "Metal.framework/Metal"
|
//go:cgo_import_dynamic _ _ "Metal.framework/Metal"
|
||||||
|
|
||||||
// It is also necessary for CoreGraphics to be linked
|
// It is also necessary for CoreGraphics to be linked
|
||||||
purego.Dlopen("/System/Library/Frameworks/CoreGraphics.framework/Versions/Current/CoreGraphics", purego.RTLD_GLOBAL)
|
purego.Dlopen("/System/Library/Frameworks/CoreGraphics.framework/Versions/Current/CoreGraphics", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Example_listDevices() {
|
func Example_listDevices() {
|
||||||
|
@ -348,7 +348,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
metal = purego.Dlopen("Metal.framework/Metal", purego.RTLD_GLOBAL)
|
metal = purego.Dlopen("Metal.framework/Metal", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
_MTLCreateSystemDefaultDevice = purego.Dlsym(metal, "MTLCreateSystemDefaultDevice")
|
_MTLCreateSystemDefaultDevice = purego.Dlsym(metal, "MTLCreateSystemDefaultDevice")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGLES.framework/Versions/Current/OpenGLES", purego.RTLD_GLOBAL)
|
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGLES.framework/Versions/Current/OpenGLES", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
if opengl != 0 {
|
if opengl != 0 {
|
||||||
isES = true
|
isES = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", purego.RTLD_GLOBAL)
|
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getProcAddress(name string) uintptr {
|
func getProcAddress(name string) uintptr {
|
||||||
|
Loading…
Reference in New Issue
Block a user