-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call C dlfcn functions directly on android (#263)
- Loading branch information
1 parent
b9dbbd0
commit 9340835
Showing
7 changed files
with
83 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2024 The Ebitengine Authors | ||
|
||
package purego | ||
|
||
import "github.com/ebitengine/purego/internal/cgo" | ||
|
||
// Source for constants: https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/dlfcn.h | ||
|
||
const ( | ||
is64bit = 1 << (^uintptr(0) >> 63) / 2 | ||
is32bit = 1 - is64bit | ||
RTLD_DEFAULT = is32bit * 0xffffffff | ||
RTLD_LAZY = 0x00000001 | ||
RTLD_NOW = is64bit * 0x00000002 | ||
RTLD_LOCAL = 0x00000000 | ||
RTLD_GLOBAL = is64bit*0x00100 | is32bit*0x00000002 | ||
) | ||
|
||
func Dlopen(path string, mode int) (uintptr, error) { | ||
return cgo.Dlopen(path, mode) | ||
} | ||
|
||
func Dlsym(handle uintptr, name string) (uintptr, error) { | ||
return cgo.Dlsym(handle, name) | ||
} | ||
|
||
func Dlclose(handle uintptr) error { | ||
return cgo.Dlclose(handle) | ||
} | ||
|
||
func loadSymbol(handle uintptr, name string) (uintptr, error) { | ||
return Dlsym(handle, name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters