|
@@ -7,10 +7,10 @@ import 'package:ffi/ffi.dart' as ffi;
|
|
import 'package:flutter/foundation.dart' as Foundation;
|
|
import 'package:flutter/foundation.dart' as Foundation;
|
|
|
|
|
|
// ignore_for_file: unused_import, camel_case_types, non_constant_identifier_names
|
|
// ignore_for_file: unused_import, camel_case_types, non_constant_identifier_names
|
|
-final DynamicLibrary _dl = _open();
|
|
|
|
|
|
+final DynamicLibrary _dart_ffi_lib = _open();
|
|
|
|
|
|
/// Reference to the Dynamic Library, it should be only used for low-level access
|
|
/// Reference to the Dynamic Library, it should be only used for low-level access
|
|
-final DynamicLibrary dl = _dl;
|
|
|
|
|
|
+final DynamicLibrary dl = _dart_ffi_lib;
|
|
DynamicLibrary _open() {
|
|
DynamicLibrary _open() {
|
|
if (Platform.environment.containsKey('FLUTTER_TEST')) {
|
|
if (Platform.environment.containsKey('FLUTTER_TEST')) {
|
|
final prefix = "${Directory.current.path}/.sandbox";
|
|
final prefix = "${Directory.current.path}/.sandbox";
|
|
@@ -18,7 +18,8 @@ DynamicLibrary _open() {
|
|
return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
|
return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
|
if (Platform.isAndroid)
|
|
if (Platform.isAndroid)
|
|
return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
|
return DynamicLibrary.open('${prefix}/libdart_ffi.so');
|
|
- if (Platform.isMacOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
|
|
|
|
|
|
+ if (Platform.isMacOS)
|
|
|
|
+ return DynamicLibrary.open('${prefix}/libdart_ffi.dylib');
|
|
if (Platform.isIOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
|
|
if (Platform.isIOS) return DynamicLibrary.open('${prefix}/libdart_ffi.a');
|
|
if (Platform.isWindows)
|
|
if (Platform.isWindows)
|
|
return DynamicLibrary.open('${prefix}/dart_ffi.dll');
|
|
return DynamicLibrary.open('${prefix}/dart_ffi.dll');
|
|
@@ -42,8 +43,8 @@ void async_event(
|
|
_invoke_async(port, input, len);
|
|
_invoke_async(port, input, len);
|
|
}
|
|
}
|
|
|
|
|
|
-final _invoke_async_Dart _invoke_async =
|
|
|
|
- _dl.lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_event');
|
|
|
|
|
|
+final _invoke_async_Dart _invoke_async = _dart_ffi_lib
|
|
|
|
+ .lookupFunction<_invoke_async_C, _invoke_async_Dart>('async_event');
|
|
typedef _invoke_async_C = Void Function(
|
|
typedef _invoke_async_C = Void Function(
|
|
Int64 port,
|
|
Int64 port,
|
|
Pointer<Uint8> input,
|
|
Pointer<Uint8> input,
|
|
@@ -63,8 +64,8 @@ Pointer<Uint8> sync_event(
|
|
return _invoke_sync(input, len);
|
|
return _invoke_sync(input, len);
|
|
}
|
|
}
|
|
|
|
|
|
-final _invoke_sync_Dart _invoke_sync =
|
|
|
|
- _dl.lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_event');
|
|
|
|
|
|
+final _invoke_sync_Dart _invoke_sync = _dart_ffi_lib
|
|
|
|
+ .lookupFunction<_invoke_sync_C, _invoke_sync_Dart>('sync_event');
|
|
typedef _invoke_sync_C = Pointer<Uint8> Function(
|
|
typedef _invoke_sync_C = Pointer<Uint8> Function(
|
|
Pointer<Uint8> input,
|
|
Pointer<Uint8> input,
|
|
Uint64 len,
|
|
Uint64 len,
|
|
@@ -82,7 +83,7 @@ int init_sdk(
|
|
}
|
|
}
|
|
|
|
|
|
final _init_sdk_Dart _init_sdk =
|
|
final _init_sdk_Dart _init_sdk =
|
|
- _dl.lookupFunction<_init_sdk_C, _init_sdk_Dart>('init_sdk');
|
|
|
|
|
|
+ _dart_ffi_lib.lookupFunction<_init_sdk_C, _init_sdk_Dart>('init_sdk');
|
|
typedef _init_sdk_C = Int64 Function(
|
|
typedef _init_sdk_C = Int64 Function(
|
|
Pointer<ffi.Utf8> path,
|
|
Pointer<ffi.Utf8> path,
|
|
);
|
|
);
|
|
@@ -96,7 +97,7 @@ int set_stream_port(int port) {
|
|
}
|
|
}
|
|
|
|
|
|
final _set_stream_port_Dart _set_stream_port =
|
|
final _set_stream_port_Dart _set_stream_port =
|
|
- _dl.lookupFunction<_set_stream_port_C, _set_stream_port_Dart>(
|
|
|
|
|
|
+ _dart_ffi_lib.lookupFunction<_set_stream_port_C, _set_stream_port_Dart>(
|
|
'set_stream_port');
|
|
'set_stream_port');
|
|
|
|
|
|
typedef _set_stream_port_C = Int32 Function(
|
|
typedef _set_stream_port_C = Int32 Function(
|
|
@@ -111,7 +112,7 @@ void link_me_please() {
|
|
_link_me_please();
|
|
_link_me_please();
|
|
}
|
|
}
|
|
|
|
|
|
-final _link_me_please_Dart _link_me_please = _dl
|
|
|
|
|
|
+final _link_me_please_Dart _link_me_please = _dart_ffi_lib
|
|
.lookupFunction<_link_me_please_C, _link_me_please_Dart>('link_me_please');
|
|
.lookupFunction<_link_me_please_C, _link_me_please_Dart>('link_me_please');
|
|
typedef _link_me_please_C = Void Function();
|
|
typedef _link_me_please_C = Void Function();
|
|
typedef _link_me_please_Dart = void Function();
|
|
typedef _link_me_please_Dart = void Function();
|
|
@@ -123,7 +124,7 @@ void store_dart_post_cobject(
|
|
_store_dart_post_cobject(ptr);
|
|
_store_dart_post_cobject(ptr);
|
|
}
|
|
}
|
|
|
|
|
|
-final _store_dart_post_cobject_Dart _store_dart_post_cobject = _dl
|
|
|
|
|
|
+final _store_dart_post_cobject_Dart _store_dart_post_cobject = _dart_ffi_lib
|
|
.lookupFunction<_store_dart_post_cobject_C, _store_dart_post_cobject_Dart>(
|
|
.lookupFunction<_store_dart_post_cobject_C, _store_dart_post_cobject_Dart>(
|
|
'store_dart_post_cobject');
|
|
'store_dart_post_cobject');
|
|
typedef _store_dart_post_cobject_C = Void Function(
|
|
typedef _store_dart_post_cobject_C = Void Function(
|