Skip to content

FFI will not run in release mode unless the Testability flag is set (IOS) #924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
EPADDO opened this issue Aug 28, 2023 · 3 comments
Open

Comments

@EPADDO
Copy link

EPADDO commented Aug 28, 2023

Hello,
I have some C which I have used the FFI interface to reference C functions. It works perfectly in debug mode on IOS14 device and it also works perfectly on the release mode but only if I enable the testability flag. No matter what else is tried inclusive of changing the strip style to non global, the method cannot be found for the C routine. In addition, it is not C++ code so I cant specify the attribute flag.
It seems that the symbols are stripped out that references the method. Is there any other work around for this?
Tried calling: call(Pointer: address=0x122f0e160, 32, Pointer: address=0x282a955c0)
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:38)
dart-archive/ffi#1 _objectNoSuchMethod (dart:core-patch/object_patch.dart:85)
dart-archive/ffi#2 speex_enc_dec.encodeAudio (package:rapid_app/speex_enc_dec.dart:166)
dart-archive/ffi#3 onStart. (package:rapid_app/main.dart:430)
dart-archive/ffi#4 _RootZone.runUnaryGuarded (dart:async/zone.dart:1593)

Regards David.

@dcharkes
Copy link
Collaborator

Did you use flutter create --template=plugin_ffi --platform=ios?

Trying to use FFI from scratch often has issues with bundling (see the existing iOS issues on the Flutter repository). That is why we have created that template. Please use that template.

@EPADDO
Copy link
Author

EPADDO commented Aug 29, 2023

Thank-you. I shall try that method and revert back.

@EPADDO
Copy link
Author

EPADDO commented Sep 1, 2023

Hello, that has fixed the issue. I do have one question though, these flags were not honoured and I needed to set some of the defines manually in the c code s.compiler_flags
the -D flags are not used when the plugin compiles.
= [
'-GCC_WARN_INHIBIT_ALL_WARNINGS',
'-w',
'-DFIXED_POINT',
'-DUSE_KISS_FFT',
'-UHAVE_CONFIG_H',

]

@dcharkes dcharkes transferred this issue from dart-archive/ffi Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants