-
Notifications
You must be signed in to change notification settings - Fork 1
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
target
-independent bindings
#3
Comments
First of all thanks for the write-up!
I'm happy to remove
Does your fork address this or is that what the feature guards are for? I'm not entirely sure what your use case is for using a different target like
Good idea! I see you've added the regenerate step to the CI and upload the artifacts from there. Thanks again and merry Christmas! |
Merry Christmas! 🎄
I use the
See https://github.com/Irate-Walrus/stardust-rs for an example use case. However, I have another use case which involves using some of the defined structs in riscv64 (this resulted in the
I didn't have much luck regenerating on linux and if the bindings are pre-built then I don't need to. In
I'd be keen, I was making the edits on my fork with this in mind. However, there is no Windows ARM64 github runner so we'd probably have to pursue cross-compilation first. |
Update: Got a bit too excited, while I am able to generate the bindings the free runner is in fact not The weirdest part about all of this is that I have "Git for Windows" installed which is on |
RIP, I do that all the time. So if that doesn't decide to work it's a hosted runner (windows on a rpi always feels so wrong to me) or cross-compilation. |
After spending almost 60 USD and well over 200 runs on the ARM64 machine, I've finally managed to install
It takes around 10 minutes to set everything up, under normal circumstances the CI will not be triggered very often, however. |
Far out man you're throwing cash around 💸. Great job getting it working and I hope you don't have to run those builds too often 0.0 |
@Irate-Walrus I've replaced |
Apologies for the slow reply, I'm just back from some time I took to disconnect.
Regarding this replacement I believe that this still suffers from the issue that |
Alright, I've shipped a custom |
Yeah easy that appears to work, although the use case of using |
I think you're referring to the conditional compilation, I'm not comfortable regexing over the bindings. Unfortunately there hasn't been any feedback from the maintainers yet. |
Yeah awesome, the regex is just a quick hack. Just checked out that PR, I hope it gets merged. |
Currently bindings are restricted to
windows
andx86_64
/x86
. This is reflected in thesrc/ffi/generated.rs
:There are two reasons I found for this:
cty
crate depends on thetarget
to create ctype definitionsextern
blocks rely on linked symbols and ABIs such asstdcall
may not be possible on other targets.My use case is such that I wish to use structures such as
PPEB
on non-native targets such asi686-unknown-linux-gnu
.This being the case I forked this repository, which can be found here: https://github.com/Irate-Walrus/phnt-rs
In this fork I introduced a pre-generated
x86_64_bindgen.rs
andx86_bindgen.rs
as well as two feature flagsexterns
andfn_types
.externs
allows externally linked symbols to be enabled/disabled:While
fn_types
defines the externally linked functions as types:This is helpful if you are trying to call these functions directly in memory:
I've also added to the GitHub workflows to auto-regenerate both
x86
andx86_64
bindings and commit them to the repo.There are a few issues that I've seen so far:
build.rs
lead to failure with the latest bindgen version0.71.1
cty
for internally defined ctypes may break compatibility with pre-existing users.rustfmt
to allow for the use of regex when feature-gating externs and function types.This issue is to gauge your interest in these changes, although it's likely I may continue in the fork to add further definitions from other header files. Thanks for you hard work, it made these changes relatively straightforward.
The text was updated successfully, but these errors were encountered: