Target flutter FFI w/ C++ compilation

Hello! I’ve seen a few topics here where people discuss Flutter with Haxe, however they’re mostly in the context of using Dart as a compilation target. I’m very new to Haxe so forgive my ignorance here, but shouldn’t it be possible to target C++ for compilation then use the Flutter FFI? Here are the docs, also here’s one example. There are a number of people in the Rust community taking advantage of the FFI to create primarily Rust-based mobile apps with generally good reviews on the FFI performance.

Basically what I’m trying to determine is if it would be reasonable to use Haxe for the business logic for both the web and mobile versions of an app I’m working on. I’m very familiar with the options, but really prioritizing Flutter for mobile and a separate JS-based web app. Would love to share some code between them if possible though!

Yes, this would be possible with the c++ target. Take a look at this post: Is there a way to expose a Haxe library as a library for another target - #2 by dmitryhryppa

I imagine you could make a shared library with any target you want, it would just take a bit of effort to figure out. For example the JVM target can be compiled to native code with GraalVM.

Embedding the LuaVM or Hashlink could probably work too. :thinking:

1 Like

Great! Thanks for the links, will give me a little more research to do. I couldn’t think of a reason it wouldn’t work, but figured I’d sanity check myself before I went too far.

1 Like