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

Swift direct C++ interop (aka Linux support) #563

Closed
wants to merge 1 commit into from

Conversation

danpalmer
Copy link

@danpalmer danpalmer commented Feb 4, 2025

This PR was superseded by #568 which implemented the Swift support based on the C bindings to work around limitations in the Swift C++ interop.

This is a WIP implementation of a direct Swift to C++ implementation. It includes the necessary modulemap for Swift to understand the C++ codebase, the SPM updates, and a WIP port of the code in USearchObjective to Swift.

Unfortunately this doesn't work. There are two main issues:

  1. Swift/C++ interop does not bridge nested types in generic types, this means the result types can't be bridged. This likely requires a non-trivial refactor, or an intermediate bridge to be built in C++. This is unfortunately beyond my very limited C++ abilities.
  2. An ambiguity in simsimd around the sqrt function available. I commented out the offending lines in order to progress, but it likely needs to be solved in that library.

Next steps:

I can't complete this, however if someone is willing to contribute just the necessary C++ code to meet the Swift interop requirements, I'm happy to finish up the Swift, refactor USearchIndex and Index+Sugar, get the tests working, etc.

@danpalmer
Copy link
Author

Closing in favour of #568.

@danpalmer danpalmer closed this Feb 9, 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.

1 participant