Skip to content

jextract/ffm: Support returning Strings#651

Merged
ktoso merged 1 commit intoswiftlang:mainfrom
ktoso:string-ffm
Mar 28, 2026
Merged

jextract/ffm: Support returning Strings#651
ktoso merged 1 commit intoswiftlang:mainfrom
ktoso:string-ffm

Conversation

@ktoso
Copy link
Copy Markdown
Collaborator

@ktoso ktoso commented Mar 28, 2026

For now we do this by copying twice... copy swift string into c string, return pointer, then we copy that into Java string and free the C string.

We can do better in the future and also consider #337 [JExtract] Translate String to a imported type #337

but for now I just wanted to get an API with Strings working in FFM

java side

Add runtime tests in ffm sample

jextract/ffm: Support returning Strings, we copy and have to free it on
java side
@ktoso
Copy link
Copy Markdown
Collaborator Author

ktoso commented Mar 28, 2026

Just fixed the formatting

@ktoso ktoso merged commit 3c579c4 into swiftlang:main Mar 28, 2026
60 of 61 checks passed
@ktoso ktoso deleted the string-ffm branch March 28, 2026 05:24
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