Skip to content

dart:ffi Strings #35762

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
dcharkes opened this issue Jan 25, 2019 · 5 comments
Closed

dart:ffi Strings #35762

dcharkes opened this issue Jan 25, 2019 · 5 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-ffi

Comments

@dcharkes
Copy link
Contributor

Add library functions to convert Dart strings to C strings and vice versa.

@dcharkes dcharkes added this to the Dart VM FFI Flutter MVP milestone Jan 25, 2019
@dcharkes dcharkes self-assigned this Jan 25, 2019
@kevmoo kevmoo added the area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. label Jan 25, 2019
@dcharkes
Copy link
Contributor Author

dcharkes commented Mar 7, 2019

In our tests (and a simplistic SQLite wrapper) we use https://github.com/dart-lang/sdk/blob/master/tests/standalone_2/ffi/cstring.dart

It's so simple it should probably not be part of the sdk.

However, we might need something more performant (which avoids copying), if this is not performant enough.

@mit-mit mit-mit removed this from the Dart VM FFI Flutter MVP milestone Mar 11, 2019
@dcharkes dcharkes removed their assignment Jul 19, 2019
@mit-mit
Copy link
Member

mit-mit commented Sep 11, 2019

There's an initial version of this now in https://github.com/dart-lang/ffi

We should see if we can make memory management easier. It would be very beneficial if you could pass string constants to C functions and now have to worry about free'ing them.

@dcharkes
Copy link
Contributor Author

Great! Thanks @sjindel-google and @mit-mit!

Should we migrate our examples and tests to depend on package:ffi instead of having duplicated code? (Though how do we prevent our tests/samples from breaking? Should we pin the version we use?)

@mit-mit
Copy link
Member

mit-mit commented Sep 11, 2019

Yes, I think we should.

Examples that are apps generally protect themselves using dependency pinning (i.e. checking in the .lock file): https://dart.dev/guides/libraries/private-files#pubspeclock

@dcharkes
Copy link
Contributor Author

We've got support for strings in package:ffi. I've opened a new issue for copy-free strings. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-ffi
Projects
None yet
Development

No branches or pull requests

3 participants