From 4791729e8ae3a52332671d07fb5ca25bdf8ab456 Mon Sep 17 00:00:00 2001 From: Baiju Meswani Date: Wed, 14 Feb 2024 21:31:06 -0800 Subject: [PATCH] Add c types to native methods --- src/csharp/NativeMethods.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/csharp/NativeMethods.cs b/src/csharp/NativeMethods.cs index c5ae8d7ee..b3c272c47 100644 --- a/src/csharp/NativeMethods.cs +++ b/src/csharp/NativeMethods.cs @@ -25,7 +25,7 @@ internal class NativeLib [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern IntPtr /* OgaResult* */ OgaCreateModel(byte[] /* const char* */ configPath, - DeviceType deviceType, + DeviceType /* OgaDeviceType */ deviceType, out IntPtr /* OgaModel** */ model); [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] @@ -41,15 +41,15 @@ internal class NativeLib // This function is used to set the maximum length that the generated sequences can have. [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern IntPtr /* OgaResult* */ OgaGeneratorParamsSetMaxLength(IntPtr /* OgaGeneratorParams* */ generatorParams, - IntPtr maxLength); + IntPtr /* int */ maxLength); // This function is used to set the input IDs for the generator. [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern IntPtr /* OgaResult* */ OgaGeneratorParamsSetInputIDs(IntPtr /* OgaGeneratorParams* */ generatorParams, - int[] /* int32_t* */ inputIDs, - UIntPtr inputIDsCount, - UIntPtr sequenceLength, - UIntPtr batchSize); + int[] /* const int32_t* */ inputIDs, + UIntPtr /* size_t */ inputIDsCount, + UIntPtr /* size_t */ sequenceLength, + UIntPtr /* size_t */ batchSize); [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern IntPtr /* OgaResult* */ OgaCreateGenerator(IntPtr /* OgaModel* */ model, @@ -74,14 +74,14 @@ internal class NativeLib // This function returns the length of the sequence at the given index. [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern UIntPtr /* size_t */ OgaGenerator_GetSequenceLength(IntPtr /* OgaGenerator* */ generator, - IntPtr index); + IntPtr /* int */ index); // This function returns the sequence data at the given index. The returned pointer is owned by the // OgaGenerator object and will be freed when the OgaGenerator object is destroyed. It is expected // that the caller copies the data returned by this function after calling this function. [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern IntPtr /* const in32_t* */ OgaGenerator_GetSequence(IntPtr /* OgaGenerator* */ generator, - IntPtr index); + IntPtr /* int */ index); [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern void OgaDestroySequences(IntPtr /* OgaSequences* */ sequences); @@ -96,14 +96,14 @@ internal class NativeLib // as per OgaSequencesGetSequenceCount. [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern UIntPtr OgaSequencesGetSequenceCount(IntPtr /* OgaSequences* */ sequences, - UIntPtr sequenceIndex); + UIntPtr /* size_t */ sequenceIndex); // This function returns the sequence data at the given index of the OgaSequences object. The returned // pointer is owned by the OgaSequences object and will be freed when the OgaSequences object is destroyed. // It is expected that the caller copies the data returned by this function after calling this function. [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)] public static extern IntPtr /* const int32_t* */ OgaSequencesGetSequenceData(IntPtr /* OgaSequences* */ sequences, - UIntPtr sequenceIndex); + UIntPtr /* size_t */ sequenceIndex); // This function is used to generate sequences for the given model using the given generator parameters. [DllImport(NativeLib.DllName, CallingConvention = CallingConvention.Winapi)]