I am assigned to assign some library procedures to C # so that our other application developers can access it, but I donβt know how to declare variables so that they enter the procedure correctly.
The problem is that when I look at input with C ++ code, I get all the distorted values
Attempted use:
double[] Par = { 8, 16, 8, 0.61, 0.00635, ... }; // 29 variables double[] Inlet = { 22.18, 43.31, 1.13, 2.81, 0.43 }; // 5 variables double[] Outlet = { 0, 0, 0, 0, 0, 0 }; // placeholder for 6 variables SteadyFor(ref Par, ref Inlet, ref Outlet, FileIn, FileOut);
DLL Import
[DllImport(MODELAPP, EntryPoint = "SteadyFor", ExactSpelling = false)] public static extern int SteadyFor( ref double[] par, ref double[] inlet, ref double[] outlet, [MarshalAs(UnmanagedType.LPStr)] string input, [MarshalAs(UnmanagedType.LPStr)] string output);
C ++ file:
extern "C" int SteadyFor(double Par[], double Inlet[], double Outlet[], char* FileIn, char* FileOut) { int n = (int)Par[0];
Obviously, the values ββthat I get are incorrect - almost like uninitialized memory.
Can someone tell me what I am doing wrong and how to fix it?
Hi,
~ Joe