Skip to content

Commit 10f7ab1

Browse files
Expose NativeLibrary APIs
Expose the System.Runtime.Interop.NativeLibrary APIs implemented in CoreCLR. API review: #32015 CoreCLR Change: dotnet/coreclr#21821 Tests for the API are here: https://github.com/dotnet/coreclr/blob/master/tests/src/Interop/NativeLibrary/NativeLibraryTests.cs
1 parent a53ada1 commit 10f7ab1

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,16 @@ protected MarshalDirectiveException(System.Runtime.Serialization.SerializationIn
730730
public MarshalDirectiveException(string message) { }
731731
public MarshalDirectiveException(string message, System.Exception inner) { }
732732
}
733+
public static partial class NativeLibrary
734+
{
735+
public static void Free(System.IntPtr handle) { }
736+
public static System.IntPtr GetExport(System.IntPtr handle, string name) { throw null; }
737+
public static System.IntPtr Load(string libraryPath) { throw null; }
738+
public static System.IntPtr Load(string libraryName, System.Reflection.Assembly assembly, DllImportSearchPath? searchPath) { throw null; }
739+
public static bool TryGetExport(IntPtr handle, string name, out IntPtr address) { throw null; }
740+
public static bool TryLoad(string libraryPath, out System.IntPtr handle) { throw null; }
741+
public static bool TryLoad(string libraryName, System.Reflection.Assembly assembly, DllImportSearchPath? searchPath, out System.IntPtr handle) { throw null; }
742+
}
733743
[System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited = false)]
734744
public sealed partial class OptionalAttribute : System.Attribute
735745
{

src/System.Runtime.InteropServices/src/ApiCompatBaseline.netcoreappaot.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetExceptionPo
1616
MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetEndComSlot(System.Type)' does not exist in the implementation but it does exist in the contract.
1717
MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.IsTypeVisibleFromCom(System.Type)' does not exist in the implementation but it does exist in the contract.
1818
TypeCannotChangeClassification : Type 'System.Runtime.InteropServices.HandleRef' is marked as readonly in the contract so it must also be marked readonly in the implementation.
19-
Total Issues: 15
19+
TypesMustExist : Type 'System.Runtime.InteropServices.NativeLibrary' does not exist in the implementation but it does exist in the contract.
20+
Total Issues: 16

src/System.Runtime.InteropServices/src/ApiCompatBaseline.uapaot.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetExceptionPo
1616
MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.GetEndComSlot(System.Type)' does not exist in the implementation but it does exist in the contract.
1717
MembersMustExist : Member 'System.Runtime.InteropServices.Marshal.IsTypeVisibleFromCom(System.Type)' does not exist in the implementation but it does exist in the contract.
1818
TypeCannotChangeClassification : Type 'System.Runtime.InteropServices.HandleRef' is marked as readonly in the contract so it must also be marked readonly in the implementation.
19-
Total Issues: 17
19+
TypesMustExist : Type 'System.Runtime.InteropServices.NativeLibrary' does not exist in the implementation but it does exist in the contract.
20+
Total Issues: 18

0 commit comments

Comments
 (0)