This commit is contained in:
problematicconsumer
2023-12-01 12:56:24 +03:30
parent 9c165e178b
commit ed614988a2
181 changed files with 3092 additions and 2341 deletions

View File

@@ -0,0 +1,15 @@
import 'dart:ffi';
import 'package:ffi/ffi.dart';
R withMemory<R, T extends NativeType>(
int size,
R Function(Pointer<T> memory) action,
) {
final memory = calloc<Int8>(size);
try {
return action(memory.cast());
} finally {
calloc.free(memory);
}
}