"error Using MATLAB Data API with C Matrix API is not supported."

15 次查看(过去 30 天)
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.

采纳的回答

Manoj Mirge
Manoj Mirge 2023-5-16
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 个)

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by