mlx tutorial: interfacing with c++

6 visualizaciones (últimos 30 días)
Zohar
Zohar el 24 de En. de 2022
Comentada: Aniket el 28 de Dic. de 2022
I followed the 4-step tutorial (matlab 2019b):
A couple of parameters (ReturnCArrays, OverwriteExistingDefinitionFiles) weren't recognizable in clibgen.generateLibraryDefinition(), so I ran it without them.
summary(definematrixlib) and build(definematrixlib) ran fine. But step 4 didn't work:
Unable to resolve the name clib.matrixlib.Mat
and the doc and help matrixlib showed nothing.
---
The school example doesn't work either:
After adding this switch to build the library
I click the link to addpath, but 'help clib.school' returns
clib.school not found.
  2 comentarios
Zohar
Zohar el 26 de En. de 2022
Let's start with some basic questions.
What are the final files that are needed to run a plugin?
Which file tells matlab about the interface and new class?
Is there a complete (final) example that comes with matlab?
Aniket
Aniket el 28 de Dic. de 2022
I recently followed the Matrix example on Matlab 2019b and it worked fine. The following step is necessary-
Put the compiled library file in the folder with the MATLAB® interface file. Uncomment and execute one of these statements based on your selected compiler.
%copyfile(fullfile(productPath,"win64","mingw64","*.dll"),".","f")
%copyfile(fullfile(productPath,"win64","microsoft","*.dll"),".","f")
Call addpath on the folder containing the interface file.

Iniciar sesión para comentar.

Respuesta aceptada

Zohar
Zohar el 1 de Jun. de 2022
Editada: Zohar el 1 de Jun. de 2022
In matlab 2021a it works fine.
When you run
matObj = clib.matrixlib.Mat
It looks for a file (in the path) "matrixlibInterface.dll" (which you need to build with the mlx steps), and it needs nothing beyond that.
Note that this file has a dependency on matrixOperations.dll, which needs to be in the path as well. Else, windows will give you the useless error of:
Unable to load interface library: 'matrixlibInterface.dll'. Reason: The
specified module could not be found.
Ensure the C++ dependent libraries for the interface library are added to run-time path.
which means the file couldn't be found or one of its dependencies is missing.
This C++ interface is pretty convenient compared to the C interface, where you need a .mex file per function.

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by