【发布时间】:2013-06-20 17:16:57
【问题描述】:
我使用 matlab 2013 编译了一个小程序
我可以在我的 dll 中看到:
Test.TestMethods我所有的功能
我已将其添加为对我的 dot net 项目的引用,并从 matlab bin\win64\v2.0 文件夹中添加了 MWArray 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
【问题讨论】:
-
你的问题有点含糊。
Test.TestMethods是什么?MWArray是托管 dll 还是本机?你怎么打电话给MWArray?你能把TestMethodss'构造函数的代码贴出来吗? -
这是matlab编译器生成的函数。我可以尝试 ildisasmble 它..
-
嗯,只需确保您已将所有依赖项复制到当前工作目录中(例如,
MWArray可能依赖于 matlab 文件夹中存在的其他 dll 之一)。尝试复制所有的 dll,看看是否有区别。 -
也尝试了 TestNative Dll。同样的事情。
-
你试过ilnumerics.net吗?从那以后,我再也没有接触过整个 Matlab 编译器,只使用纯托管代码。没有理由继续折磨自己......只是我的2C
标签: .net matlab matlab-compiler