Browse Source

Merge pull request #561 from sharwell/function-pointer

Mark delegates with UnmanagedFunctionPointer
tags/v0.20
Haiping GitHub 5 years ago
parent
commit
43b182ed07
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      src/TensorFlowNET.Core/APIs/c_api.cs

+ 4
- 0
src/TensorFlowNET.Core/APIs/c_api.cs View File

@@ -50,8 +50,12 @@ namespace Tensorflow
return handle == IntPtr.Zero ? String.Empty : Marshal.PtrToStringAnsi(handle); return handle == IntPtr.Zero ? String.Empty : Marshal.PtrToStringAnsi(handle);
} }


[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void Deallocator(IntPtr data, IntPtr size, ref DeallocatorArgs args); public delegate void Deallocator(IntPtr data, IntPtr size, ref DeallocatorArgs args);

[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DeallocatorV2(IntPtr data, long size, IntPtr args); public delegate void DeallocatorV2(IntPtr data, long size, IntPtr args);

public struct DeallocatorArgs public struct DeallocatorArgs
{ {
internal static unsafe c_api.DeallocatorArgs* EmptyPtr; internal static unsafe c_api.DeallocatorArgs* EmptyPtr;


Loading…
Cancel
Save