Skip to content
Snippets Groups Projects
Commit 970f3684 authored by rhdjw's avatar rhdjw
Browse files

Fixed missing pointer increment. Changed P/Invoke charset to Unicode.

parent d5c1e740
No related branches found
No related tags found
No related merge requests found
...@@ -27,52 +27,52 @@ internal class Capi ...@@ -27,52 +27,52 @@ internal class Capi
{ {
public delegate void resultDlg(IntPtr result, ref CNetwork network, IntPtr data); public delegate void resultDlg(IntPtr result, ref CNetwork network, IntPtr data);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, EntryPoint = "kiss_free", CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, EntryPoint = "kiss_free", CallingConvention=CallingConvention.StdCall)]
public static extern void free(IntPtr ptr); public static extern void free(IntPtr ptr);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern IntPtr kiss_create_range(float start, float end, UIntPtr length, byte log); public static extern IntPtr kiss_create_range(float start, float end, UIntPtr length, byte log);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern void kiss_resample_spectra(float[] in_re, float[] in_im, UIntPtr input_length, ref IntPtr ret_ptr_real, ref IntPtr ret_ptr_imag, UIntPtr output_length); public static extern void kiss_resample_spectra(float[] in_re, float[] in_im, UIntPtr input_length, ref IntPtr ret_ptr_real, ref IntPtr ret_ptr_imag, UIntPtr output_length);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern void kiss_normalize_spectra(float[] in_re, float[] in_im, UIntPtr input_length); public static extern void kiss_normalize_spectra(float[] in_re, float[] in_im, UIntPtr input_length);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern IntPtr kiss_absgrad(float[] in_re, float[] in_im, float[] omegas, UIntPtr input_length, UIntPtr index); public static extern IntPtr kiss_absgrad(float[] in_re, float[] in_im, float[] omegas, UIntPtr input_length, UIntPtr index);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern float kiss_grad(float[] data, float[] omegas, UIntPtr input_length, UIntPtr index); public static extern float kiss_grad(float[] data, float[] omegas, UIntPtr input_length, UIntPtr index);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern float kiss_median(float[] data, UIntPtr input_length); public static extern float kiss_median(float[] data, UIntPtr input_length);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern byte kiss_reduce_spectra(float[] in_re, float[] in_im, float[] omegas, UIntPtr input_length, float thresh_factor, public static extern byte kiss_reduce_spectra(float[] in_re, float[] in_im, float[] omegas, UIntPtr input_length, float thresh_factor,
byte use_second_deriv, ref IntPtr out_re, ref IntPtr out_im, ref UIntPtr output_length); byte use_second_deriv, ref IntPtr out_re, ref IntPtr out_im, ref UIntPtr output_length);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern byte kiss_filter_spectra(float[] in_re, float[] in_im, float[] omegas, UIntPtr input_length, public static extern byte kiss_filter_spectra(float[] in_re, float[] in_im, float[] omegas, UIntPtr input_length,
ref IntPtr out_re, ref IntPtr out_im, UIntPtr output_length); ref IntPtr out_re, ref IntPtr out_im, UIntPtr output_length);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern byte kiss_load_network_prealloc(ref CNetwork net, string path, resultDlg callback, byte verbose); public static extern byte kiss_load_network_prealloc(ref CNetwork net, string path, resultDlg callback, byte verbose);
[DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("libc", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern void puts(string path); public static extern void puts(string path);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern void kiss_free_network_prealloc(ref CNetwork net); public static extern void kiss_free_network_prealloc(ref CNetwork net);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern byte kiss_async_run_inference(ref CNetwork net, [Out] float[] inputs, IntPtr data); public static extern byte kiss_async_run_inference(ref CNetwork net, [Out] float[] inputs, IntPtr data);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern byte kiss_async_run_inference_complex(ref CNetwork net, [Out] float[] real, [Out] float[] imag, IntPtr data); public static extern byte kiss_async_run_inference_complex(ref CNetwork net, [Out] float[] real, [Out] float[] imag, IntPtr data);
[DllImport("kissinference", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention=CallingConvention.StdCall)] [DllImport("kissinference", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention=CallingConvention.StdCall)]
public static extern IntPtr kiss_get_strerror(ref CNetwork net); public static extern IntPtr kiss_get_strerror(ref CNetwork net);
public static string[] IntPtrToUtf8Array(IntPtr array) public static string[] IntPtrToUtf8Array(IntPtr array)
...@@ -107,6 +107,7 @@ internal class Capi ...@@ -107,6 +107,7 @@ internal class Capi
break; break;
bytes.Add(b); bytes.Add(b);
idx++;
} }
return System.Text.Encoding.UTF8.GetString(bytes.ToArray()); return System.Text.Encoding.UTF8.GetString(bytes.ToArray());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment