Skip to content

NoSuchMethodError: The method '_mulFromInteger' was called on null. #517

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

Closed
RdeWilde opened this issue Jul 25, 2020 · 1 comment · Fixed by dart-archive/ffigen#69
Closed
Labels
package:ffigen type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@RdeWilde
Copy link

I get this error NoSuchMethodError: The method '_mulFromInteger' was called on null. on several include files, but I can't understand why.
I tried adding it to the header-filter excludes too, but that didn't fix it either.

What is the problem?

Source file:

#include <netaddress.h>

Config:

ffigen:
  output: 'generated_bridge.dart'
  headers:
    - 'src/example/src/example.h'
  header-filter:
    exclude:
      - 'netaddress.h'
  name: 'Bridge'
  description: 'Bridge'
  array-workaround: true

Last part of output:

Unhandled exception:
NoSuchMethodError: The method '_mulFromInteger' was called on null.
Receiver: null
Tried calling: _mulFromInteger(1)
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
dart-lang/ffigen#1      int.* (dart:core-patch/integers.dart:16:38)
dart-lang/ffigen#2      ArrayHelper.expandedArrayLength (package:ffigen/src/code_generator/struc.dart:176:33)
dart-lang/ffigen#3      ArrayHelper.declarationString (package:ffigen/src/code_generator/struc.dart:196:25)
dart-lang/ffigen#4      Struc.toBindingString (package:ffigen/src/code_generator/struc.dart:111:29)
dart-lang/ffigen#5      Writer.generate (package:ffigen/src/code_generator/writer.dart:153:17)
dart-lang/ffigen#6      Library.generate (package:ffigen/src/code_generator/library.dart:106:14)
dart-lang/ffigen#7      Library.generateFile (package:ffigen/src/code_generator/library.dart:88:28)
dart-lang/ffigen#8      main (file:///home/robert/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/ffigen-0.1.2/bin/ffigen.dart:51:11)
dart-lang/ffigen#9      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
dart-lang/ffigen#10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
pub finished with exit code 255
@mannprerak2
Copy link
Contributor

I was able to reproduce this issue for this header -

struct T1{
    int k;
    int a[];
};

This is happening due to flexible array member (a).

And the reason you are not able to exclude is because structs are auto added if any function depends on it. See #520

@mannprerak2 mannprerak2 added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jul 25, 2020
@liamappelbe liamappelbe transferred this issue from dart-archive/ffigen Nov 15, 2023
parlough pushed a commit to parlough/native that referenced this issue Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:ffigen type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants