How can I load an assembly dll into Matlab ?
19 views (last 30 days)
Show older comments
Hello,
I'm using NET package on Matlab. I need to use an assembly which is an API of a certain device : "vciapi.dll". I want to load it into Matlab using this instruction :
library = NET.addAssembly('C:\Windows\System32\vciapi.dll');
But when I run this instruction, an error occurs, which is :
Message: Could not load file or assembly
'file:///C:\Windows\System32\vciapi.dll' or one of its dependencies. The module was expected to contain an assembly manifest
Source: mscorlib
HelpLink:
The version of my Matlab is 2015b, the NET framework version is 4.
For solve the problem, in a first time i verified if a supported version of the Microsoft .NET Framework exists or not, and it exists I verified with NET.isNETSupported. Also, I checked the path and it's correct.
Currently, I have no ideas to solve the problem, maybe find the manifest, thank you for your help.
2 Comments
Maitreyee Mordekar
on 23 May 2017
Hi Kamel,
Only .NET assemblies can be loaded using the “Net.addAssembly” command. A file is an assembly if and only if it is managed, and contains an assembly entry in its metadata.
Could you first check if the .NET DLL is valid .NET assembly so that you can use it with the "NET.addAssembly" command? Follow the following steps to do the same:
1) Start the Ildasm.exe (MSIL Disassembler). To run the tool, use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7).
2) Load the file you wish to test.
3) If ILDASM reports that the file is not a portable executable (PE) file, then it is not an assembly.
Hope that helps!
Raahul Jagannathan
on 21 Jun 2019
Hi, I did what you mentioned above. ILDASM mentions no such thing about the DLL file I tested. Yet I still get the originally mentioned error. Is there anything else I need to do to sort it out.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!