Helper function to get a char* pointer from a Dart string to pass it to c function.
ffi.Pointer<ffi.Char> toCharPointer(String str) { return str.toNativeUtf8().cast<ffi.Char>(); }