Skip to content

Commit

Permalink
chg the netcoreapp version of SQLitePCL.NativeLibrary to use the Load…
Browse files Browse the repository at this point in the history
… calls which take a library name instead of a library path. with this change, using provider_dynamic with System.Runtime.InteropServices.NativeLibrary for netcoreapp3 works. #248
  • Loading branch information
ericsink committed Jun 16, 2019
1 parent 7a766f7 commit aa8081a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/SQLitePCLRaw.nativelibrary/for_netcoreapp3.cs
Expand Up @@ -20,26 +20,28 @@ namespace SQLitePCL
{
public static class NativeLibrary
{
public static IntPtr Load(string libraryPath)
public static IntPtr Load(string libraryName)
{
return System.Runtime.InteropServices.NativeLibrary.Load(libraryPath);
var assy = System.Reflection.Assembly.GetExecutingAssembly();
return System.Runtime.InteropServices.NativeLibrary.Load(libraryName, assy, null);
}
public static IntPtr GetExport(IntPtr handle, string name)
{
return System.Runtime.InteropServices.NativeLibrary.GetExport(handle, name);
}
public static void Free(IntPtr handle)
public static bool TryLoad(string libraryName, out IntPtr handle)
{
System.Runtime.InteropServices.NativeLibrary.Free(handle);
var assy = System.Reflection.Assembly.GetExecutingAssembly();
return System.Runtime.InteropServices.NativeLibrary.TryLoad(libraryName, assy, null, out handle);
}
public static bool TryLoad(string libraryPath, out IntPtr handle)
public static IntPtr GetExport(IntPtr handle, string name)
{
return System.Runtime.InteropServices.NativeLibrary.TryLoad(libraryPath, out handle);
return System.Runtime.InteropServices.NativeLibrary.GetExport(handle, name);
}
public static bool TryGetExport(IntPtr handle, string name, out IntPtr address)
{
return System.Runtime.InteropServices.NativeLibrary.TryGetExport(handle, name, out address);
}
public static void Free(IntPtr handle)
{
System.Runtime.InteropServices.NativeLibrary.Free(handle);
}
}
}

0 comments on commit aa8081a

Please sign in to comment.