dart_periphery icon indicating copy to clipboard operation
dart_periphery copied to clipboard

library loader: use dart:ffi Abi instead of uname() for architecture detection

Open ardera opened this issue 2 years ago • 1 comments

Hey, thanks for the project! It's really helpful!

dart:ffi has it's own Abi class now, which you can use for architecture detection: https://api.dart.dev/stable/2.18.1/dart-ffi/Abi-class.html. It's used internally for @AbiSpecificInteger for example.

Also, make nativeUname() use /proc/sys/kernel/{ostype,hostname,osrelease,version} files and uname -m for architecture instead. (Not strictly necessary, just thought that'd be better, I think the previous method of guessing _UTSNAME_LENGTH, was nice, but maybe a bit hacky :p )

Make CpuArch._internal() use dart:ffi Abi for architecture detection, too now, instead of querying uname.

You could also remove the whole cpu_architecture.dart file since people should really be using dart:ffi's Abi class :) But that'd be a breaking change of course.

ardera avatar May 16 '23 13:05 ardera

Thanks for your submission. I will include these changes for the next relaase 0.9.6. For this release I will update the https://github.com/vsergeev/c-periphery libs. After two years an update is available.

pezi avatar May 17 '23 15:05 pezi