Calling new on Matlab Generated Class from Dot Net Crushes the App (m_interpreter.dll)
2 views (last 30 days)
Show older comments
'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
0 Comments
Answers (4)
Konstantin Tarkus
on 9 Jul 2013
Having exactly the same issue. Any ideas how to solve it?
0 Comments
Konstantin Tarkus
on 9 Jul 2013
Turned out it doesn't work on .NET 4.5 and also doesn't work when VS debugger is attached.
0 Comments
Friedrich
on 9 Jul 2013
Hi,
try disabling the JIT from the C# side:
[assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]
Does it work now?
3 Comments
tri truong
on 11 Aug 2014
I have same your problem. I try added [assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]. still fail. help me plase
Jonathan
on 17 Jan 2015
Edited: Jonathan
on 17 Jan 2015
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 Comment
Anatoly Khamukhin
on 25 Jan 2018
Edited: Anatoly Khamukhin
on 25 Jan 2018
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
See Also
Categories
Find more on MATLAB Compiler SDK in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!