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

조회 수: 14 (최근 30일)
Mark Almquist
Mark Almquist 2023년 4월 30일
답변: Manoj Mirge 2023년 5월 16일
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