MATLAB Answers

Error loading .net Assembly from a Matlab exectuable.

11 views (last 30 days)
danielh
danielh on 3 Aug 2017
Answered: KAE on 12 Feb 2021
I am trying to compile some .m files along with a DLL in to a matlab executable using the following command:
mcc -m Interface.m -a Z:\PROJ\mydll.dll
where Interface.m loads the assembly as follows:
NET.addAssembly('Z:\PROJ\mydll.dll')
When running the exectuable, I get the following error:
"Could not load file of assembly 'file:///Z:\PROJ\mydll.dll' or one of its dependencies. Operation is not supported. (Exception from HRESEULT: 0x80131515)
Source: mscorlib"
I also tried the following combination:
NET.addAssembly('mydll.dll');
mcc -m Interface.m -a mydll.dll
In which case I get a different error message:
'mydll.dll' could not be found in the .NET Global Assembly Cache (GAC).
Previous answers suggested checking the DLL is not blocked. I checked and it is not. Any ideas how to get around this problem? Thanks!

Answers (1)

KAE
KAE on 12 Feb 2021
Matlab staff should answer this, there are a couple similar questions on Answers

Community Treasure Hunt

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

Start Hunting!