diff --git a/dart/r2pipe-ffi.dart b/dart/r2pipe-ffi.dart index 46a7530..d9aa50c 100644 --- a/dart/r2pipe-ffi.dart +++ b/dart/r2pipe-ffi.dart @@ -14,6 +14,29 @@ typedef RCoreNew = ffi.Pointer Function(); typedef RCoreFreeFunc = ffi.Void Function(ffi.Pointer); typedef RCoreFree = void Function(ffi.Pointer); +/* + https://pub.dev/packages/ffi/example + ------------------------------------ + +import 'dart:ffi'; +import 'package:ffi/ffi.dart'; + +void main() { + // Allocate and free some native memory with calloc and free. + final pointer = calloc(); + pointer.value = 3; + print(pointer.value); + calloc.free(pointer); + + // Use the Utf8 helper to encode zero-terminated UTF-8 strings in native memory. + final String myString = 'πŸ˜ŽπŸ‘ΏπŸ’¬'; + final Pointer charPointer = myString.toNativeUtf8(); + print('First byte is: ${charPointer.cast().value}'); + print(charPointer.toDartString()); + calloc.free(charPointer); +} + +*/ void main() { print('Hello Radare2 from Dart!');