itinero / reminiscence

A library for cross-platform memory mapping.
MIT License
9 stars 6 forks source link

Native memory-mapped arrays: fix pointer offset. #24

Closed airbreather closed 4 years ago

airbreather commented 4 years ago

When trying to use some of the code from NativeMemoryMappedArray<T> in another project, I discovered an issue with the pointer offset: https://stackoverflow.com/a/42170762/1083771.

This fixes that issue and tweaks an existing test so that it would fail on Windows systems without the fix.

xivk commented 4 years ago

Is there any way of making this library netstandard2.0 only and still maintain some of these native features? .net core would also be acceptable but I would prefer to get rid of any .NET framework dependency because currently it forces me to maintain a windows machine.

airbreather commented 4 years ago

Is there any way of making this library netstandard2.0 only and still maintain some of these native features?

In theory, the full public API of the NativeMemory* types already works fine on all netstandard2.0 platforms. I haven't tested it out on anything but .NET Framework and .NET Core (both on Windows), but it works in both places, and it should also work on other supported operating systems.

The only #if NET45 stuff in there is to bridge some API gaps in .NET Framework 4.5.

xivk commented 4 years ago

Ok, then dropping that would mean dropping support for .NET framework 4.5 -> 4.6.1 right?

BTW thanks again for all the help, I'm really struggling to keep up with maintaining everything so it's important for me to simplify.

airbreather commented 4 years ago

Ok, then dropping that would mean dropping support for .NET framework 4.5 -> 4.6.1 right?

Technically yes, 4.6.1 and above could run it.

In practice, framework versions lower than 4.7.2 have a tough time referencing .NET Standard libraries, so I would say it's best to act as if 4.7.2 is the lowest version.

it's important for me to simplify.

I totally get that, netstandard2.0-only is a lot easier than multi-targeting.