[ffigen] Work around analyzer bug for FfiNatives (#455)
* Work around analyzer bug for FfiNatives
* another pointer arg
diff --git a/pkgs/ffigen/example/ffinative/generated_bindings.dart b/pkgs/ffigen/example/ffinative/generated_bindings.dart
index 794f28f..ea0436b 100644
--- a/pkgs/ffigen/example/ffinative/generated_bindings.dart
+++ b/pkgs/ffigen/example/ffinative/generated_bindings.dart
@@ -11,9 +11,9 @@
);
/// Subtracts 2 integers.
-@ffi.FfiNative<ffi.Int Function(ffi.Pointer<ffi.Int>, ffi.Int)>('subtract')
+@ffi.FfiNative<ffi.Int Function(ffi.Int, ffi.Int)>('subtract')
external int subtract(
- ffi.Pointer<ffi.Int> a,
+ int a,
int b,
);
@@ -32,10 +32,9 @@
);
/// Divides 2 floats, returns a pointer to double.
-@ffi.FfiNative<
- ffi.Pointer<ffi.Double> Function(
- ffi.Pointer<ffi.Float>, ffi.Pointer<ffi.Float>)>('dividePrecision')
+@ffi.FfiNative<ffi.Pointer<ffi.Double> Function(ffi.Float, ffi.Float)>(
+ 'dividePrecision')
external ffi.Pointer<ffi.Double> dividePrecision(
- ffi.Pointer<ffi.Float> a,
- ffi.Pointer<ffi.Float> b,
+ double a,
+ double b,
);
diff --git a/pkgs/ffigen/example/ffinative/headers/example.h b/pkgs/ffigen/example/ffinative/headers/example.h
index 40c6b9e..44056dd 100644
--- a/pkgs/ffigen/example/ffinative/headers/example.h
+++ b/pkgs/ffigen/example/ffinative/headers/example.h
@@ -6,7 +6,7 @@
int sum(int a, int b);
/** Subtracts 2 integers. */
-int subtract(int *a, int b);
+int subtract(int a, int b);
/** Multiplies 2 integers, returns pointer to an integer,. */
int *multiply(int a, int b);
@@ -15,4 +15,4 @@
float *divide(int a, int b);
/** Divides 2 floats, returns a pointer to double. */
-double *dividePrecision(float *a, float *b);
+double *dividePrecision(float a, float b);