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

Need a safe way to import dispatch and Block headers on Linux #8149

Open
lhoward opened this issue Nov 30, 2024 · 0 comments
Open

Need a safe way to import dispatch and Block headers on Linux #8149

lhoward opened this issue Nov 30, 2024 · 0 comments

Comments

@lhoward
Copy link

lhoward commented Nov 30, 2024

Description

I often use GCD on Linux to wrap existing callback-based APIs so they may be better imported by Swift. The GCD headers are present in $prefix/usr/lib/swift/dispatch and .../Block but are not in the include path.

Alternatives considered

  • rewrite wrappers in Swift; this is a fine long-term solution
  • use unsafe C flags to amend include path; because unsafe flags break tagged imports, this is not a long-term workable solution
  • copy and paste necessary headers; this is workable for _Block_copy() and _Block_release() but gets hairy for libdispatch
  • wrap the headers in new modules; this ultimately creates a module import conflict

Proposed solution

Currently I'm copy pasting declarations in (third alternative solution above), but ideally those headers would be in the include path for C modules built by Swift.

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.0.2-dev

Swift & OS version (output of swift --version && uname -a)

Swift version 6.0.2 (swift-6.0.2-RELEASE)
Target: aarch64-unknown-linux-gnu
Linux liebling 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 23:26:06 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant