C++ Interface workarounds for limitations

11 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 28 de Sept. de 2021
Editada: MathWorks Support Team el 11 de Abr. de 2022
How can I work around some of the limitations for the C++ Interface?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 11 de Abr. de 2022
Editada: MathWorks Support Team el 11 de Abr. de 2022
Below is a list of some of the C++ Interface limitations. In some cases a workaround is provided.
Creating objects of classes in the std namespace 
  • Workaround:  example with std::stack
  • std::wstring and other std::string variants
    • Support starting in: R2020b
  • std::complex  
    • Support starting in: R2022a
  • std::vector as a class data member
    • Support starting in: R2022a
Class templates with incomplete or no instantiations
Arrays and vectors of class objects
  • Support starting in: R2020a
void*
  • Support starting in: R2021a
Function pointer
  • Support starting in: R2021a
Preprocessor directives
Array of std::string
  • Workaround: string arrays
  • void foo(std::string[] s)
  • std::vector<std::string>
    • Support starting in: R2021a
Data member
  • Array/Pointer data members
    • Support starting in: R2020a
  • Reference data members
More detail is supplied in the Workaround links, but these general steps apply:
To run the workaround examples on Windows®:
  • Download or copy the C++ header file statements into .hpp files.
  • Download or copy the source code into .cpp files and build, using instructions in How to build a  shared library file for the C++ Interface on Windows .
  • Execute the MATLAB code to build the interface.
  • If required, edit the library definition file.
  • Execute the MATLAB code to test the functionality.

Más respuestas (0)

Categorías

Más información sobre Call C++ from MATLAB en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by