Closed
Description
Right now, for a function like this in C:
char* my_function(char* value) { ... }
ffigen
generates bindings like this:
Pointer<Char> myFunction(Pointer<Char> value) { ... }
Requiring calling Dart code to look like so:
final results = bindings.myFunction(
'a string'.toNativeUtf8().cast<Char>(),
);
print(results.cast<Utf8>().toDartString());
If instead, ffigen
generated the following code:
String myFunction(String value) {
final result = nativeFunction(value.toNativeUtf8().cast<Char>());
return result.cast<Utf8>().toDartString();
}
then using ffigen
would become tremendously more straightforward.