Compiling a matlab function into a C shared .dll library

1 vue (au cours des 30 derniers jours)
Leor Greenberger
Leor Greenberger le 18 Juin 2013
I have 5 matlab functions that I have compiled into 5 separate shared C .dll to use with an existing software written in C. Each of these functions are independent of each other and perform a unique procedure using an instrument over VISA. In the application that I want to integrate the matlab shared libraries, the user may select from the UI which procedures to run. It may include all 5 functions, a subset of the 5, or none at all. The user may also choose to rerun any one or all of the functions.
Reading through the Compiler documentation, I found that
<lib>Terminate will bring down enough of the MCR address
space that the same library (or any other library) cannot be initialized.
Issuing a <lib>Initialize call after a <lib>Terminate call causes
unpredictable results. Instead, use the following structure:
...code...
mclInitializeApplication();
lib1Initialize();
lib2Initialize();
lib1Terminate();
lib2Terminate();
mclTerminateApplication();
...code...
So I am wondering what is the best practice here for loading all the libraries. Should I initialize all of them at the beginning of the application, even if I may not use all of them and terminate them all at the conclusion?
Another question is: I have a folder that contains a number of matlab functions that I either wrote myself or downloaded from FEX. The 5 functions that I am compiling separately call some of these functions. Since I am compiling each primary function separately, some of the shared functions may be compiled multiple times. This seems like bad practice. I am wondering if there is an alternative?
Thanks!
  2 commentaires
Leor Greenberger
Leor Greenberger le 18 Juin 2013
One other thing. I am using the instrument control toolbox in matlab to setup GPIB and VISA connections to various instruments. Each of the compiled matlab functions open and close these connections. I was wondering if there was anyway to leave them open between calling each function via mlf<lib>?
Leor Greenberger
Leor Greenberger le 19 Juin 2013
Anyone?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Instrument Control Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by