我想PInvoke从C#用VB6编写的函数.我们可以在VB6中调用这个函数,如下所示:
Declare Function ApplyNNet Lib " location of the DLL file" (MyNNetType As String, MyAddress As String, MyInput() As Double) As Variant
Run Code Online (Sandbox Code Playgroud)
我在C#中的代码是:
[DllImport("NNetApply.dll", EntryPoint = "ApplyNNet", CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr ApplyNNet(string type, string add, double[,] data);
//run ANN with data
string address = @"C:\Users\PNGE-User\Desktop\Faegheh\Project\Neural Network For Pressure Vs q,x,y\P ve x,y,q\P ve x,y,q";
double[,] P = new double[no_data,2];
var P_ = ApplyNNet("Back Prop", address, data);
Run Code Online (Sandbox Code Playgroud)
当我调试我的代码时,出现错误:
尝试读取或写入受保护的内存.这通常表明其他内存已损坏.