Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call C dlfcn functions directly on android #263

Merged
merged 12 commits into from
Aug 5, 2024

Conversation

TotallyGamerJet
Copy link
Collaborator

What issue is this addressing?

Closes #262

What type of issue is this addressing?

bug

What this PR does | solves

Before we were link naming to the C symbols and hard coding the C constants on android. This PR calls the C functions directly.

@TotallyGamerJet
Copy link
Collaborator Author

TotallyGamerJet commented Aug 2, 2024

So to test this, rollback hajimehoshi/ebiten@297efea and then test in Test Lab using a purego that has this PR in it.

dlfcn_android.go Outdated Show resolved Hide resolved
@hajimehoshi
Copy link
Contributor

The test has passed!
image

dlfcn_android_32bit.go Outdated Show resolved Hide resolved
dlfcn_android_64bit.go Outdated Show resolved Hide resolved
@hajimehoshi
Copy link
Contributor

347a581 also passed the tests (i.e. the hardcoded values worked!)

dlfcn_freebsd.go Outdated Show resolved Hide resolved
dlfcn_android_64bit.go Outdated Show resolved Hide resolved
dlfcn.go Outdated Show resolved Hide resolved
dlfcn_freebsd.go Outdated Show resolved Hide resolved
Copy link
Contributor

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test this with 32bit Android again

dlfcn_darwin.go Outdated
RTLD_NOW = 0x2 // Relocations are performed when the object is loaded.
RTLD_LOCAL = 0x4 // All symbols are not made available for relocation processing by other modules.
RTLD_GLOBAL = 0x8 // All symbols are available for relocation processing of other modules.
RTLD_DEFAULT = 0xffffffff_fffffffe // Pseudo-handle for dlsym so search for any loaded symbol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 << 64 - 2 might be better

@hajimehoshi
Copy link
Contributor

hajimehoshi commented Aug 3, 2024

Building failed for Android

# github.com/ebitengine/purego
/Users/hajimehoshi/purego/func.go:155:8: non-boolean condition in if statement
/Users/hajimehoshi/purego/func.go:420:7: is32bit redeclared in this block
        /Users/hajimehoshi/purego/dlfcn_android.go:12:2: other declaration of is32bit

exit status 1
make: *** [buildAndroidRuntime] Error 1

Copy link
Contributor

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've confirmed this worked with Android 32bit and 64bit. LGTM, thanks!

@TotallyGamerJet TotallyGamerJet merged commit 9340835 into ebitengine:main Aug 5, 2024
23 checks passed
@TotallyGamerJet TotallyGamerJet deleted the issue-262_android branch August 5, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

purego.Dlopen fails on Galaxy A02s
2 participants