Skip to content

[_AtomicShims] On Darwin, call swift_retain_n/swift_release_n via dlsym #95

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

Closed

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Aug 10, 2023

This avoids a linker failure when the build system decides to build this module as a standalone library.

Hopefully this will all go away soon, when swift_retain_n/swift_release_n will become primitives exposed by the stdlib.

rdar://108390931

Checklist

  • I've read the Contribution Guidelines
  • My contributions are licensed under the Swift license.
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (if appropriate).
  • I've verified that my change does not break any existing tests.
  • I've updated the documentation if necessary.

This avoids a linker failure when the build system decides to build this module as a standalone library.

Hopefully this will all go away soon, when swift_retain_n/swift_release_n will become primitives exposed by the stdlib.
@lorentey lorentey requested a review from glessard August 10, 2023 22:09
@lorentey lorentey linked an issue Aug 10, 2023 that may be closed by this pull request
2 tasks
@lorentey
Copy link
Member Author

@swift-ci test

Copy link
Contributor

@glessard glessard left a comment

Choose a reason for hiding this comment

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

This workaround looks good. However, as you yourself asked: is this allowed on iOS?

@lorentey
Copy link
Member Author

Quick search indicates that it's okay, at least as long as dlopen/dlsym is only used to load specific, hardwired symbols from public libraries. So it appears this will be fine.

@lorentey
Copy link
Member Author

Closing in favor of #97.

@lorentey lorentey closed this Aug 14, 2023
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.

import Atomics won't compile in Playgrounds
2 participants