How do I use the mclInitializeApplication function to make a C-shared library that does not use the JVM or JIT in MATLAB 7.0 (R14)?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 10 Sep 2012
Modifié(e) : MathWorks Support Team
le 26 Avr 2023
I am using MATLAB Compiler 4.0 (R14), and I would like to make a C-shared library that does not use the Java Virtual Machine (JVM) or the Just-In-Time (JIT) accelerator. How can I do this?
Réponse acceptée
MathWorks Support Team
le 26 Avr 2023
Modifié(e) : MathWorks Support Team
le 26 Avr 2023
The C/C++ shared libraries created with the MATLAB Compiler can be run in "nojvm" and/or "nojit" mode.
This is accomplished through the use of the mclInitializeApplication function. The function signatures for this function is as follows:
bool mclInitializeApplication(const char **options, int count);
In other words, mclInitializeApplication takes an array of strings of user-settable options and a count of the number of options (the length of the option array). This function returns true (1) for success and false (0) for failure.
To specify that the library should not use the Java Virtual Machine, the option string is "nojvm". To specify that the library should not use the JIT, use the option string "nojit" .
The use of these options is illustrated in the following example, where a MATLAB-generated library named "hello" is called
int main()
{
char *pStrings[]={"-nojvm","-nojit"};
if (!mclInitializeApplication(pStrings,2))
{
fprintf(stderr, "Could not initialize MCR for the application.\n");
return -1;
}
if(!helloInitialize())
{
fprintf(stderr, "Could not initialize the library.\n");
return -1;
}
mlfHello();
helloTerminate();
mclTerminateApplication();
return 0;
}
For more information about calling a MATLAB-generated shared library, see the "C Shared Library Example" section of the MATLAB Compiler SDK documentation:
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!