Capstone.NET icon indicating copy to clipboard operation
Capstone.NET copied to clipboard

Support ReadOnlySpan<byte> input for Disassemble

Open darkf opened this issue 6 years ago • 3 comments

It would let us use memory from anywhere (including other native pointers) and Span<byte>s without copying to a byte[] array. It makes it more in-line with the standard library which often supports both, too.

darkf avatar May 29 '19 07:05 darkf

Hello. ReadOnlySpan<T> is only supported on .NET Core right now. It is not supported on .NET Standard, which is the target framework the library currently targets when it compiles. I would either have to add .NET Core as an extra target framework and conditionally compile an overload that accepts a ReadOnlySpan<T> as an argument or wait until .NET Standard 2.1 is released, which will support ReadOnlySpan<T>. Let me explore those options and get back to you.

9ee1 avatar May 29 '19 17:05 9ee1

The System.Memory package backports it to .NET Standard, so conditional compilation would be unnecessary.

https://www.nuget.org/packages/System.Memory/#supportedframeworks-body-tab

ds5678 avatar Dec 14 '23 18:12 ds5678

I took a brief look into the issue, and the use of delegates seems to be the primary barrier to ReadOnlySpan<byte> support.

ds5678 avatar Dec 14 '23 19:12 ds5678