Code Monkey home page Code Monkey logo

Comments (4)

fuzzybinary avatar fuzzybinary commented on July 19, 2024

Hi @GavinRay97 (sorry for the late reply...)

I'm not sure what 100% sure what you're asking.

If you're just wondering if you could auto-generate C-callable functions that would initialize Dart for you and call into Dart code, I believe that's entirely possible, but probably outside of the scope of this example. This tells you how to initialize the Dart VM for embedding, and you could use that knowledge to create the generated code.

If you're more wondering about calling into compiled Dart, this example doesn't go into it, but you can initialize the Dart VM to compile .dart code, or load a pre-compiled library for JITting, or load an AOT compiled library. All three initialize about the same way with a few minor differences, but so far as I know you would still have to go through Dart functions to serialize / deserialize variables, so you can't just pull in a function pointer.

So, I think what you're asking is entirely possible, but probably won't be part of this repo.

Let me know if I totally misunderstood your question!

from dart-embedding-example.

GavinRay97 avatar GavinRay97 commented on July 19, 2024

Hey, no worries

If you're just wondering if you could auto-generate C-callable functions that would initialize Dart for you and call into Dart code, I believe that's entirely possible, but probably outside of the scope of this example. This tells you how to initialize the Dart VM for embedding, and you could use that knowledge to create the generated code.

I think this answers my question. Thank you!

Dart lets you compile Dart code to a binary. But you can't compile Dart code to a .dll/.so/.dylib etc.

Was curious if using this approach, you could produce a shared library, which exported your Dart methods as C-callable functions.

I think the only missing piece here for that is the codegen that you mentioned (which yes, is entirely out of scope for this).

from dart-embedding-example.

fuzzybinary avatar fuzzybinary commented on July 19, 2024

Yes, that's accurate. You could codegen all the necessary stuff to create your own dynamically linked library.

In reality, I'd love the dart team to support the embedded dart vm in a .dll / .so / .dylib, but I'm not sure that's coming any time soon.

from dart-embedding-example.

GavinRay97 avatar GavinRay97 commented on July 19, 2024

In reality, I'd love the dart team to support the embedded dart vm in a .dll / .so / .dylib, but I'm not sure that's coming any time soon.

So would I. There's no reason it couldn't be done + by my estimate, one person could do the feature realistically over some sprints. (At least a minimal working implementation and codegen)

I brought this up in a GH issue where they outright ignored the question, and then I told them I felt hurt by being outright ignored (not even told "no we're not doing it") and then they told me it's an out-of-scope question for the issue.

🤷

Priorities I guess

from dart-embedding-example.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.