"error Using MATLAB Data API with C Matrix API is not supported."
14 views (last 30 days)
Show older comments
I wish to use ArrayFactory, but when I include "MatlabDataArray.hpp" in my main cpp I get this error when I do an mbuild using the .so and main cpp.
Under the Library Compiler App, I am compiling a C++ shared library. Under the "API Selection" option | "C++ Shared Library API", regardless of whether I select "Create interfaces that use mwArray API and MATLAB Data API" or ""Create interfaces that use mwArray API", I get this error.
I cannot find mention of this particular error anywhere.
Thanks for any help.
Mark A.
0 Comments
Accepted Answer
Manoj Mirge
on 16 May 2023
This error occurs when you try to compile C++ shared library which uses functions from MATLAB Data API and MATLAB C API.It might be possible that you are mixing the functions from MATLAB Data API with functions from MATLAB C API in your library.
The MATLAB Data API supports C++11 features and is not compatible with the C Matrix API or MATLAB C API. You cannot mix functions from the MATLAB Data API with those in the C Matrix API or C MEX API. Likewise, you cannot mix MATLAB Data API functions with functions in the MATLAB Engine API for C or MATLAB C API to Read MAT-File Data in a standalone application.
As a workaround you can migrate all your library code to use only MATLAB Data API. MATLAB Data API uses modern C++ semantics (C++11). This has several advantages over the “mwArray” API, including type-safety, multithread-safety, and copy-on-write semantics.
0 Comments
More Answers (0)
See Also
Categories
Find more on C Shared Library Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!