Skip to content

Support for Dart Extensions #2396

Closed
Closed

Description

@eseidelGoogle

https://www.dartlang.org/articles/native-extensions-for-standalone-dart-vm/

We've had at least one request for this. I suspect it's implemented entirely in the dart CLI.

My understanding is it's just a bit of code to map dart-ext: urls to making a dlopen call and passing the symbols off to the VM. @johnmccutchan

I'm mostly seeking to document how we'd do this in this bug. It's not clear if this is generically useful.

Activity

  1. added this to the milestone on Mar 3, 2016
  2. eseidelGoogle commented on Mar 3, 2016

    @eseidelGoogle
    ContributorAuthor
  3. self-assigned this
    on Mar 3, 2016
  4. johnmccutchan commented on Mar 4, 2016

    @johnmccutchan
    Contributor

    Assuming we keep this in the embedder, what happens when an import 'dart-ext:' occurs is the following:

    1. Load the .so/.dll
    2. Invoke the extensionName_Init() method.

    In existing extensions, in the _Init method mostly just wires up the native resolver for the Dart code.

    I wonder if we could formulate extensions differently and support them directly in the VM. I'll investigate this.

  5. johnmccutchan commented on Mar 9, 2016

    @johnmccutchan
    Contributor
  6. modified the milestones: , on May 26, 2016
  7. Hixie commented on May 26, 2016

    @Hixie
    Contributor

    I've moved this to the 2.0 milestone since it doesn't seem like a blocker for a quality first release.

  8. eseidelGoogle commented on Sep 20, 2016

    @eseidelGoogle
    ContributorAuthor

    This is not needed by any near-term customer. The only bug I've seen which might use this is opengl support: #179 iceboxing.

  9. nacardin commented on Jun 20, 2017

    @nacardin

    I'm currency working on an app that needs to use digital signatures, specifically EdDSA. Since there are C implementations which are stable and known to be reliable, I think it would be safer to use FFI, rather than trying to port the algorithm to dart.

    Especially with WebAssembly becoming widely supported, Flutter would be at a disadvantage if it didn't allow FFI to use native libraries.

  10. sethladd commented on Jun 20, 2017

    @sethladd
    Contributor

    You may be able to use our plugins system to communicate between the Flutter Dart code and platform-specific libraries: https://flutter.io/platform-plugins/

  11. eseidelGoogle commented on Jun 20, 2017

    @eseidelGoogle
    ContributorAuthor

    #7053 is probably what you want. You can integrate with C code today with Flutter, you just have to bounce through Java/Obj-C first.

  12. eseidelGoogle commented on Nov 12, 2018

    @eseidelGoogle
    ContributorAuthor

    This need will hopefully be covered by FFI work: dart-lang/sdk#34452 and related tooling work in: #7053

  13. ping996 commented on Oct 21, 2019

    @ping996

    does the flutter support dart native extension? according to use import 'dart-ext:library_name';
    https://dart.dev/server/c-interop-native-extensions

  14. github-actions commented on Aug 26, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  15. locked as resolved and limited conversation to collaborators on Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c: new featureNothing broken; request for a new capability

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions