mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-28 14:08:25 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
1 changed files with 768360 additions and 0 deletions
18
brutal.interop/Brutal.Interop/InteropHandleMarshaller.cs
Normal file
18
brutal.interop/Brutal.Interop/InteropHandleMarshaller.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices.Marshalling;
|
||||
|
||||
namespace Brutal.Interop;
|
||||
|
||||
[CustomMarshaller(
|
||||
typeof(CustomMarshallerAttribute.GenericPlaceholder),
|
||||
MarshalMode.Default,
|
||||
typeof(InteropHandleMarshaller<,>)
|
||||
)]
|
||||
public static class InteropHandleMarshaller<T, THandle>
|
||||
where THandle : unmanaged
|
||||
where T : struct, IInteropHandle<THandle, T>
|
||||
{
|
||||
public static THandle ConvertToUnmanaged(T managed) => managed.Pointer;
|
||||
|
||||
public static T ConvertToManaged(THandle unmanaged) => Unsafe.As<THandle, T>(ref unmanaged);
|
||||
}
|
||||
Loading…
Reference in a new issue