What toolboxes does mcc support? Failed to load C++ shared Library

16 Ansichten (letzte 30 Tage)
Fiavi Yang
Fiavi Yang am 12 Jul. 2022
Bearbeitet: Fiavi Yang am 12 Jul. 2022
Hi. I have a simple MATLAB function that uses Signal Processing Toolbox. I want to generate C++ shared libraries of this function so I used mcc,
mcc -W 'cpplib:<name of the dll>,all' -T link:lib <my function>.m
and I got a .dll, a .lib, and a .h file. However, I could not initialize and use the generated library.
Here's what I did in my c++ program to load the library. It triggers the error "Could not initialize the library properly".
#include "<Generated header file>.h"
if (!mclInitializeApplication(NULL, 0)) {
std::cerr << "Could not initialize the application properly" << std::endl;
std::cin.get();
return -1;
}
if (!<my function>Initialize()) {
std::cerr << "Could not initialize the library properly" << std::endl;
std::cin.get();
return -1;
}
//Code...
<my function>Terminate();
if (!mclTerminateApplication()) {
std::cerr << "Unexpected error during termination" <<
std::endl;
std::cin.get();
return -1;
}
This is not the first time I used mcc and integrated shared libraries in to c++ program, but this is the first time I do it with a function that uses a toolbox, and it doesn't work. So I wonder if this method supports toolboxes? Any suggestions?

Antworten (0)

Kategorien

Mehr zu C Shared Library Integration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by