필터 지우기
필터 지우기

Calling new on Matlab Generated Class from Dot Net Crushes the App (m_interpreter.dll)

조회 수: 3 (최근 30일)
've compiled a little program using matlab 2013 I can see in my dll: Test.TestMethods all my functions
I've added it as a reference to my dot net project, and added the MWArray dll from matlab bin\win64\v2.0 folder.
I've set my program to build against X64.
Once I try to create the object:
Test.TestMethods test = new Test.TestMethods();
My App crashes. I can only see in external Visual Studio instance:
Unhandled exception at 0x0000000001D36E60 (m_interpreter.dll).
Access violation reading location 0x00000000A5CE3920.
I have no idea where to start....
EDIT1: this is the ctor (there is also a static 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개)

Konstantin Tarkus
Konstantin Tarkus 2013년 7월 9일
Having exactly the same issue. Any ideas how to solve it?

Konstantin Tarkus
Konstantin Tarkus 2013년 7월 9일
Turned out it doesn't work on .NET 4.5 and also doesn't work when VS debugger is attached.

Friedrich
Friedrich 2013년 7월 9일
Hi,
try disabling the JIT from the C# side:
[assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]
Does it work now?
  댓글 수: 3
tri truong
tri truong 2014년 8월 11일
I have same your problem. I try added [assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]. still fail. help me plase

댓글을 달려면 로그인하십시오.


Jonathan
Jonathan 2015년 1월 17일
편집: Jonathan 2015년 1월 17일
I am having a very similiar issue. My however is intermittent, it appears to be dependent upon the activity on the system. During periods of low usage it seems to work fine at high usage, the application calling the {dll_name}Initilize() call crashes in the m_interperter.dll...
I am using the -nojit
const char *pStrings[] = { "-nojit" };
mclInitializeApplication(pStrings, 0);
seems to behave the same either way...
please help...
-Chad
  댓글 수: 1
Anatoly Khamukhin
Anatoly Khamukhin 2018년 1월 25일
편집: Anatoly Khamukhin 2018년 1월 25일
You were so close to finish... Replace 0 to 1 (it is count of items in pStrings). You were so close to finish... Replace 0 to 1 (it is count of items in pStrings). Also "-nojit" seems to be obsolete now (Matlab2017).
const char *args[] = {"-nojvm"};
const int count = sizeof(args) / sizeof(args[0]);
mclInitializeApplication(args, count))
solved the problem for me

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by