mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.55k stars 543 forks source link

Use LibraryImport instead of DllImport on net7+ for better performance #2964

Closed Youssef1313 closed 4 months ago

Youssef1313 commented 4 months ago

Is your feature request related to a problem?

Performance

Describe the solution you would like

Update SkiaSharpGenerator to use LibraryImport when possible, e.g:

                    writer.WriteLine($"\t\t#if NET7_0_OR_GREATER");
                    writer.WriteLine($"\t\t[LibraryImport ({config.DllName})]");
                    writer.WriteLine($"\t\t#else");
                    writer.WriteLine($"\t\t[DllImport ({config.DllName}, CallingConvention = CallingConvention.Cdecl)]");
                    writer.WriteLine($"\t\t#endif");

(Not sure if it will be that trivial)

Describe alternatives you have considered

N/A

Additional context

No response

Code of Conduct

Gillibald commented 4 months ago

https://github.com/mono/SkiaSharp/pull/2917

Youssef1313 commented 4 months ago

Thanks. Closing as a duplicate of https://github.com/mono/SkiaSharp/issues/2615 then