How can I load an assembly dll into Matlab ?

21 次查看(过去 30 天)
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 个评论
Maitreyee Mordekar
Maitreyee Mordekar 2017-5-23
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
Raahul Jagannathan 2019-6-21
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Microsoft .NET 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by