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

2 vues (au cours des 30 derniers jours)
'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

Réponses (4)

Konstantin Tarkus
Konstantin Tarkus le 9 Juil 2013
Having exactly the same issue. Any ideas how to solve it?

Konstantin Tarkus
Konstantin Tarkus le 9 Juil 2013
Turned out it doesn't work on .NET 4.5 and also doesn't work when VS debugger is attached.

Friedrich
Friedrich le 9 Juil 2013
Hi,
try disabling the JIT from the C# side:
[assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]
Does it work now?
  3 commentaires
Friedrich
Friedrich le 15 Juil 2013
Any update on this? Did it work?
tri truong
tri truong le 11 Août 2014
I have same your problem. I try added [assembly: MathWorks.MATLAB.NET.Utility.MWMCROption("-nojit")]. still fail. help me plase

Connectez-vous pour commenter.


Jonathan
Jonathan le 17 Jan 2015
Modifié(e) : Jonathan le 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 commentaire
Anatoly Khamukhin
Anatoly Khamukhin le 25 Jan 2018
Modifié(e) : Anatoly Khamukhin le 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Compiler SDK dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by