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

Reference to sequence of &str in UDL #2268

Open
iUnknwn opened this issue Oct 12, 2024 · 1 comment
Open

Reference to sequence of &str in UDL #2268

iUnknwn opened this issue Oct 12, 2024 · 1 comment

Comments

@iUnknwn
Copy link

iUnknwn commented Oct 12, 2024

I'm testing out uniffi for a project, and I'd like to expose a function that takes a list of strings to C#.

The function signature is:

pub fn take_names(names: &[&str]) -> String

However, I can't seem to declare a sequence of references. This doesn't build, failing with a UDL parse error:

string take_names([ByRef] sequence<[ByRef] string> names);

And removing the internal ByRef results in a compile error due to to the type mismatch.

Is there a recommendation for this?

I'm currently using uniffi v0.25 (unfortunately C# bindings do not work with more recent versions).

@mhammond
Copy link
Member

Sorry, we can't pass references over the ffi like that - it has to be strings I think #1974 is what we have open for that.

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

No branches or pull requests

2 participants