Has anyone looked at creating a Dart/C++ bindings library along the lines of Boost.Python? I couldn't find anything general-purpose after a bit of searching. There's https://github.com/StevenChristy/SFML2-Dart-Binding and https://github.com/donny-dont/DartEmbeddingDemo as examples of how to use the Dart native API, but nothing that I could find that attempts to provide a general solution.
How much interest would there be in something like this? I will likely end up writing something fairly simple for my own use, but I could also see creating/contributing to a standalone library. One option would be to add Dart support to SWIG, but I'd love to include good support for both synchronous and asynchronous calls and I'm not sure how well that would fit with the SWIG model.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
Hi Rico,
Yes, a while ago I did get some simple bindings working based on the existing native extensions support as described in that article - the sort of bindings library I imagined would build on top of the existing functionality to make it easier to expose a large set of C++ classes to Dart.
Your FFI stuff looks cool - can you comment at all on what sort of use cases you're considering as you design it? I can imagine that a binding layer aimed at (for instance) high-performance C function calls could look rather different than one aimed at exposing complex C++ classes and objects (where ownership/lifetime management can get more tricky).
As an example, the overhead of calling a c function in the current interface is pretty low (we use it internally in fletch as well). You can optimize this by having handwritten platform specific natives for pushing arguments to the stack (or into registers depending on ABI). We are considering exposing natives that allow you to do this manually, for more efficient/elegant handling of structs/classes. There is absolutely no reason to make the simple c call slower to allow for more complex stuff.But again, the above will be driven by the use cases and issues we see moving forward
--