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

chore: allow closure as license callback #21

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

marcbull
Copy link
Contributor

This allows a closure to be used in the `set_license_callback' function. This is an extension of pull request #20, which introduced a global variable holding an external C function.

  • Removes unsafe code to set the CALLBACK_FUNCTION, which could lead to data races, if set_license_callback is called from different threads.
  • Removes the requirement to use an extern "C" fn in pure Rust code. (see examples/license-activation.rs)
  • Closures allow to capture the enclosing environment.

@ahmad-kemsan ahmad-kemsan self-requested a review September 19, 2024 07:41
@ahmad-kemsan ahmad-kemsan merged commit 121176e into cryptlex:main Sep 19, 2024
4 checks passed
@ahmad-kemsan
Copy link
Collaborator

@marcbull Thank you for submitting the PR to use closures for the license callback! The PR has been successfully merged.

@marcbull
Copy link
Contributor Author

@ahmad-kemsan Thanks for accepting the PR.

@marcbull marcbull deleted the improve-callback branch September 19, 2024 08:05
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