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 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 10 Set 2012
Modificato: MathWorks Support Team
il 26 Apr 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?
Risposta accettata
MathWorks Support Team
il 26 Apr 2023
Modificato: MathWorks Support Team
il 26 Apr 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!