MWMCR exception - Attempted to read or write protected memory.
Mostra commenti meno recenti
I have made a Matlab .dll with my .NET builder, but when i try to access the class MDClass in my namespace MelanomaDetection get the following error:
{"The type initializer for 'MelanomaDetection.MDClass' threw an exception."}
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
MWArray at MathWorks.MATLAB.NET.Utility.MWMCR.mclIsMCRInitialized() at MathWorks.MATLAB.NET.Utility.MWMCR..cctor()
I just initialize it like this:
var m = new MDClass();
I don't have any restrictions in my Matlab program, neither in my .NET app.
Thanks in advance for any help!
Risposte (2)
Kaustubha Govind
il 7 Ott 2011
1 voto
Have you copied mclmcrrt7x.dll to a location outside of the MCR installation directory? It looks like that could cause this error: http://www.mathworks.com/support/solutions/en/data/1-AN5VOX/index.html
8 Commenti
Kim
il 7 Ott 2011
Kaustubha Govind
il 10 Ott 2011
The right think to do is to add the path to the mclmcrrt7x.dll to the system PATH variable. You need to install the MCR and then add mcr_root\ver\runtime\win32|win64 to the top of the system path. See http://www.mathworks.com/help/toolbox/compiler/f12-999353.html#br2jauc-34
Kim
il 11 Ott 2011
Kaustubha Govind
il 12 Ott 2011
Yes! You need to have the 64-bit MCR installed and added to path.
Kim
il 27 Ott 2011
Kaustubha Govind
il 28 Ott 2011
No, if you're compiling with 32-bit MATLAB, you need 32-bit MCR.
Kim
il 31 Ott 2011
Kaustubha Govind
il 31 Ott 2011
Kim: Perhaps it will be best if you contact MathWorks Tech Support about this, since you seemed to have tried a lot of things already?
Guy
il 20 Ott 2011
0 voti
I've discovered a problem with mclIsMCRInitialized(), and raised it here some four months ago, in that if you try to call this function and the MCR is not initialized, then it doesn't return 0 as documented, but rather crashes with a segmentation fault. This doesn't make it terrible useful. I'd be interested to know if you're testing the return value of this function in order to then decide whether to call mclInitializeApplication(). If so, then it sounds like the same issue and I can only suggest forcing an initial MCR initialization, rather than making it conditional on a returned value of 0 from mclIsMCRInitialized().
1 Commento
Kim
il 25 Ott 2011
Categorie
Scopri di più su C Shared Library Integration in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!