Reputation: 1589
I am aware that dll files created using MATLAB Compiler require MATLAB Compiler Runtime (MCR). So the question is: a) How do I initialize MCR using Python? b) How do I access the functions in the dll file, post MCR initialization?
I am using MATLAB R2012B, MCR v80 and Python 2.7.6 on Windows 7.
Upvotes: 0
Views: 1354
Reputation: 9696
Concerning the MATLAB "features", check this blog entry by Loren:
http://blogs.mathworks.com/loren/2011/02/03/creating-c-shared-libraries-and-dlls/
It shows a pretty complete example of how to create a shared library and how to use it. Quoting example code from that link, to initialize the MCR and the generated library you'll have to call:
// Initialize the MATLAB Compiler Runtime global state
if (!mclInitializeApplication(NULL,0))
{
std::cerr << "Could not initialize the application properly."
<< std::endl;
return -1;
}
// Initialize the Vigenere library
if( !libvigenereInitialize() )
{
std::cerr << "Could not initialize the library properly."
<< std::endl;
return -1;
}
Where you'll obviously have to replace libvigenere
by your library's name.
Now you can call your generated matlab functions just as you would call any C function. And finally, shut down everything:
// Shut down the library and the application global state.
libvigenereTerminate();
mclTerminateApplication();
Concering the connection to python, there are multiple ways, all described e.g. in this question:
Upvotes: 1