3

我使用 matlab 2013 编译了一个小程序,我可以在我的 dll 中看到: Test.TestMethods 我的所有函数

我已将其添加为对我的 dot net 项目的引用,并MWArray从 matlab bin\win64\v2.0 文件夹中添加了 dll。

** 更新:应用程序在 matlabe 生成的代码中的这一行崩溃:

mcr= new MWMCR("", ctfFilePath, embeddedCtfStream, true);

如果我嵌入 ctf 文件 - 它会崩溃,如果我不嵌入它,它会抛出异常。

我已经将我的程序设置为针对 X64 构建。

一旦我尝试创建对象:

Test.TestMethods test = new Test.TestMethods();

我的应用程序崩溃。我只能在外部 Visual Studio 实例中看到:

Unhandled exception at 0x0000000001D36E60 (m_interpreter.dll). 
Access violation reading location 0x00000000A5CE3920.

我不知道从哪里开始......

EDIT1:这是ctor(还有一个静态cctor):

    .method public hidebysig specialname rtspecialname 
        instance void  .ctor() cil managed
{
  // Code size       20 (0x14)
  .maxstack  8
  IL_0000:  ldarg.0
  IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
  IL_0006:  ldsfld     class [mscorlib]System.Exception Test.TestMethods::ex_
  IL_000b:  brfalse.s  IL_0013
  IL_000d:  ldsfld     class [mscorlib]System.Exception Test.TestMethods::ex_
  IL_0012:  throw
  IL_0013:  ret
} // end of method TestMethods::.ctor
4

1 回答 1

1

您不能从 .NET 4.5 程序集调用 MATLAB 生成的 .NET 库,当附加 VS 调试器时它也会崩溃。

于 2013-07-09T05:33:14.117 回答