using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace wavelet_DLL_CSharp
{
class waveletDenoiseHeader
{
[DllImport("waveletDenoise.dll", CallingConvention = CallingConvention.Cdecl)] // C declaration calling convention
public static extern bool WaveletFilter(double[] Input, double[] Output, int signal_size);
}
}
测试
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace wavelet_DLL_CSharp
{
class Program
{
// 也可以不新建类,给出以下声明即可,dll文件要放在bin目录里哟。
// [DllImport("waveletDenoise.dll", CallingConvention = CallingConvention.Cdecl)] // C declaration calling convention
// public static extern bool WaveletFilter(double[] Input, double[] Output, int signal_size);
static void Main(string[] args)
{
double[] signal = new double[8] { 420.2, 423.53, 423.52, 423.35, 424.52, 428, 430.79, 428.92 };
double[] dsignal = new double[8];
waveletDenoiseHeader.WaveletFilter(signal, dsignal, 8);
Console.WriteLine("signal: {0}", signal[0]);
Console.WriteLine("dsignal: {0}", dsignal[0]);
Console.ReadKey();
}
}
}