Giter VIP home page Giter VIP logo

Comments (4)

shekohex avatar shekohex commented on July 1, 2024

How is it possible to have two allo-isolate in a single binary? It should only be one! Unless we have two different versions and cargo decided to link both? Which in this case is bad! I would recommend dedup Cargo.lock and find out which crate that uses the older version of allo-isolate and update it, should be only one if they both have same version.

from allo-isolate.

fzyzcjy avatar fzyzcjy commented on July 1, 2024

How is it possible to have two allo-isolate in a single binary?

  • The app uses Dart lib A and lib B
  • lib A uses a rust crate C. Thus crate C (and its dependency allo-isolate) are compiled into library_c.a and statically links to the final app
  • lib B similarly use crate D, and library_d.a

In this case we have trouble...

That said, Flutter's official template provide dynamic linking now (IIRC years ago it was static linking), so may not be a problem, unless users choose to do static linking.

from allo-isolate.

shekohex avatar shekohex commented on July 1, 2024

That said, Flutter's official template provide dynamic linking now (IIRC years ago it was static linking), so may not be a problem, unless users choose to do static linking.

iOS is always static linked, no?

But I hear you, I'm open to other ideas to set up the bridge through FFI, maybe each library author would choose their own exposed function? Through a macro, for example?

Like the following:

// in allo-isolate code lib.rs
#[macro_export]
macro_rules! mk_store_dart_post_cobject {
	($name:ident) => {
		#[no_mangle]
		pub unsafe extern "C" fn $name(ptr: ::allo_isolate::ffi::DartPostCObjectFnType) {
			::allo_isolate::POST_COBJECT.store(Some($ptr), Ordering::Relaxed);
		}
	},
}
// in my-awesome-crate lib.rs
allo_isolate::mk_store_dart_post_cobject!(my_awesome_crate_store_dart_post_cobject);

This way, we will not have a duplicated symbols.

from allo-isolate.

fzyzcjy avatar fzyzcjy commented on July 1, 2024

iOS is always static linked, no?

I also did that, but seems no today, which is surprising. -> https://github.com/flutter/flutter/blob/8b6277e63868c2029f1e2327879b7899be44fbe2/packages/flutter_tools/templates/plugin_ffi/lib/projectName.dart.tmpl#L47-L58

Through a macro, for example?

It sounds like an option.
For FRB, a solution is to create a (generated) wrapper function.

Anyway, as mentioned above, this is not a problem for the dynamic linking now.

from allo-isolate.

Related Issues (18)

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.