Matlab encounters major performance issues when interfacing with .dll referencing another .dll

2 vues (au cours des 30 derniers jours)
Hello,
I am using Matlab to interface with some measurement equipment (specifically, a VNA). The equipment vendor provides us with both a .tlb file and a .dll file (let's call it Manufacturer.dll). The .tlb file references a .dll in the Global Assembly Cache, this is all correctly configured and works well (even with Matlab, actually).
In order to that it has been decided to load this Manufacturer.dll with C# and with that class library to create a subset of this .dll (let's call it VNA.dll). This allows us to interface the functions exactly the way we want it to. This VNA.dll library works perfectly well when used from C# (let's say, in another project).
Now comes the Matlab performance issue. If I load the VNA.dll within Matlab using
NET.addAssembly('Path\to\VNA.dll')
it also works well! I can see accessible methods using
methods(myObject)
or see its properties using
properties(myObject)
the methods execute properly and without error.
However, if I want to visualize (let's say I just ask Matlab to output myObject in the workspace by simply typing out
myObject
Then Matlab comes to a brutal halt, it may take over an hour to display the types referenced from the .dll library. This is troublesome, especially considering that calling a specific method is extremely fast
This is quite an issue at the moment because it slows down development "a lot" and it prevents us to navigate through the public methods and properties using the Matlab's workspace.
There are some work-arounds such as re-coding everything inside Matlab, but this prevents us from using some very useful features that C# offer, plus we have to re-code a bunch of already coded things.
Why does Matlab exhibits this behavior, and how should I go about solving this issue. I've interfaced .dll class libraries multiple times in the past and it always worked like a charm. However, this specific class library refers to a COM object. I wonder if that may be the cause, and especially wonder how to make the performances reasonable again.
Thank you very much for your help,
Jerome
  1 commentaire
Helper
Helper le 21 Août 2018
For directly executing the variable, MATLAB actually executes disp(variable). In this situation, MATLAB basically runs disp(myObject). I have tried with several .NET Assembly on my machine, but I cannot reproduce this issue.
But specifically what disp(.NET Assembly) does is show the properties the Assembly has. Since other functions like "methods" and "properties" work properly for you, then it might a workaround for using these functions instead of using disp for Assembly Object.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by