Bump projects to .NET 6 and add DllImport resolver for iOS

This commit is contained in:
Salman Ahmed 2023-03-08 11:51:09 +03:00
parent 98a238fe07
commit e07402105e
2 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyTitle>SDL2#</AssemblyTitle> <AssemblyTitle>SDL2#</AssemblyTitle>

View file

@ -37,6 +37,12 @@ namespace SDL2
{ {
public static class SDL public static class SDL
{ {
static SDL()
{
if (OperatingSystem.IsIOS())
NativeLibrary.SetDllImportResolver(typeof(SDL).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/SDL2.framework/SDL2", assembly, path));
}
#region SDL2# Variables #region SDL2# Variables
private const string nativeLibName = "SDL2"; private const string nativeLibName = "SDL2";