dlfcn_android.go raw
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: 2024 The Ebitengine Authors
3
4 package purego
5
6 import "github.com/ebitengine/purego/internal/cgo"
7
8 // Source for constants: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/dlfcn.h
9
10 const (
11 is64bit = 1 << (^uintptr(0) >> 63) / 2
12 is32bit = 1 - is64bit
13 RTLD_DEFAULT = is32bit * 0xffffffff
14 RTLD_LAZY = 0x00000001
15 RTLD_NOW = is64bit * 0x00000002
16 RTLD_LOCAL = 0x00000000
17 RTLD_GLOBAL = is64bit*0x00100 | is32bit*0x00000002
18 )
19
20 func Dlopen(path string, mode int) (uintptr, error) {
21 return cgo.Dlopen(path, mode)
22 }
23
24 func Dlsym(handle uintptr, name string) (uintptr, error) {
25 return cgo.Dlsym(handle, name)
26 }
27
28 func Dlclose(handle uintptr) error {
29 return cgo.Dlclose(handle)
30 }
31
32 func loadSymbol(handle uintptr, name string) (uintptr, error) {
33 return Dlsym(handle, name)
34 }
35