Problem with loading dlls in a mixed matlab-C# program
12 ビュー (過去 30 日間)
古いコメントを表示
Hi Everybody
I'm gonna run below piece of code, in which some matlab-generated dlls should be run in a C# program. I've gathered the required dlls from the native folders of the Windows and put them in the debug folder of the C# project. Here is the code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices;
namespace TestTimesTwo { class TestTimesTwo { [DllImport(@"libtimestwo.dll")] private static extern void libtimestwoinItialize();
[DllImport(@"libtimestwo.dll")]
private static extern void libtimestwoTerminate();
[DllImport(@"libtimestwo.dll")]
private static extern void mlfTimestwo(int num, ref IntPtr theOutput, [In]IntPtr theInput);
[DllImport(@"libmx.dll")]
private static extern IntPtr mxCreateDoubleScalar([In]double value);
[DllImport(@"libmx.dll")]
private static extern IntPtr mxgetPr([In]IntPtr mxArray);
[DllImport(@"mclmcrtt7_14.dll")]
private static extern bool mclInitializeApplication(string option, int count);
[DllImport(@"C:\Users\Matinking\Documents\Visual Studio 2010\Projects\TestTimesTwo\TestTimesTwo\bin\Debug\mclmcr.dll")]
private static extern bool mclTerminateApplication();
[STAThread]
static void Main(string[] args)
{
bool ret;
double[] ans = new double[1];
ret = mclInitializeApplication("NULL",0);
libtimestwoinItialize();
IntPtr inVal = mxCreateDoubleScalar(3);
IntPtr outVal = IntPtr.Zero;
mlfTimestwo(1, ref outVal, inVal);
Marshal.Copy(mxgetPr(outVal), ans, 0, 1);
Console.WriteLine("The return value is" + ans[0]);
libtimestwoTerminate();
mclTerminateApplication();
}
}
}
But I confront with the rather similar errors for almost all there embedded dlls, as you can see in the attached image. I even used the RegCure pro application for fix the dlls but I got nothing!... Would you please helping me to handle this case?!
Thank you
PS. The version of the matlab is 2010b.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Java Package Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!