Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt new API in .NET Core 3.0 - System.Runtime.InteropServices.NativeLibrary #13

Open
JanVargovsky opened this issue Nov 11, 2019 · 2 comments

Comments

@JanVargovsky
Copy link

I've encountered similar issue as #2. Since that time, native API has been merged in the .NET Core 3.0, see docs.

The library may adopt these changes quite easy:

class NetCoreLibraryLoader : LibraryLoader
{
    protected override void CoreFreeNativeLibrary(IntPtr handle)
    {
        System.Runtime.InteropServices.NativeLibrary.Free(handle);
    }

    protected override IntPtr CoreLoadFunctionPointer(IntPtr handle, string functionName)
    {
        return System.Runtime.InteropServices.NativeLibrary.GetExport(handle, functionName);

    }

    protected override IntPtr CoreLoadNativeLibrary(string name)
    {
        return System.Runtime.InteropServices.NativeLibrary.Load(name);
    }
}

We would have to target .NET Core 3.0 instead of .NET Standard 2.0.

What is your opinion about changing/adding the target framework to Core 3.0? Or maybe publish both NS and Core versions? Not sure whether it works - from the consumer perspective. I've seen a few libraries dropped out NS support and target Core but I'm aware that this library is commonly used in Mono/Xamarin.

@softwareantics
Copy link

100% it would be best to keep targeting .NET Standard.

@JanVargovsky
Copy link
Author

It is not possible though. We've internally changed our library to target both .NET Standard (that has issues) and .NET Core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants