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

Replace symcrypt-bindgen crate with a script #56

Closed
wants to merge 17 commits into from

Conversation

Vaiz
Copy link
Collaborator

@Vaiz Vaiz commented Dec 27, 2024

This PR introduces several significant changes to the project, focusing on replacing the symcrypt-bindgen crate with a script. The generated bindings remain unchanged, ensuring no modifications to the public API of symcrypt-sys.

New scripts:

  • Added scripts/generate-bindings.ps1 to generate Rust bindings using bindgen for a specified target triple.
  • Added scripts/generate-all-bindings.ps1 to generate Rust bindings for all supported target triples, including installation instructions and prerequisites.
  • Added scripts/generate-bindings.sh as a helper script to set the PATH to cargo binaries and call generate-bindings.ps1.

@Vaiz
Copy link
Collaborator Author

Vaiz commented Dec 27, 2024

@microsoft-github-policy-service agree company="Microsoft"

@nnmkhang
Copy link
Contributor

unsafe extern "C" {

unsafe extern "C" causes issues for me when doing my tests. Sent a message offline.

error: extern block cannot be declared unsafe
--> symcrypt-sys\src\bindings\x86_64_pc_windows_msvc.rs:1929:1
|
1929 | unsafe extern "C" {
| ^^^^^^
|
= note: see issue #123743 <rust-lang/rust#123743> for more information


Refers to: symcrypt-sys/src/bindings/aarch64_pc_windows_msvc.rs:2894 in b57945b. [](commit_id = b57945b, deletion_comment = False)

# winget install LLVM.LLVM
# cargo install bindgen-cli
# WSL Ubuntu:
# sudo apt install pwsh clang libclang-dev
Copy link
Contributor

Choose a reason for hiding this comment

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

sudo apt install pwsh clang libclang-dev

sent a message offline

exit 1
}

$importRules = @(
Copy link
Contributor

Choose a reason for hiding this comment

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

$importRules

Is it possible to separate the allow list to a separate file? I think it would be easier to maintain rather than directly modifying the .ps1 script. Wondering your thoughts

Cargo.toml Outdated Show resolved Hide resolved
@Vaiz Vaiz marked this pull request as draft January 14, 2025 13:42
@Vaiz
Copy link
Collaborator Author

Vaiz commented Jan 14, 2025

unsafe extern "C" causes issues for me when doing my tests. Sent a message offline.

fixed by setting rust-version to 1.64.0

@Vaiz Vaiz closed this Jan 15, 2025
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.

2 participants