Borrar filtros
Borrar filtros

Building a MEX function that depends on a .dll, .lib, and headers?

38 visualizaciones (últimos 30 días)
carpetfizz
carpetfizz el 15 de Oct. de 2019
Comentada: Baptiste el 11 de Mzo. de 2024
Hello,
I have a C++ function that depends on a.dll, a.lib (import library), and some include directory. This function works fine in Microsoft Visual Studio as I can tell MSVC where my headers and libraries are.
I have put this functionality inside a "MEXFunction" and I would like to build it so that it's accessible form MATLAB. However, I don't know how to tell mex to link against third party dll, lib, and header files.
Thanks for any assistance!

Respuestas (1)

Maadhav Akula
Maadhav Akula el 4 de Nov. de 2019
  1 comentario
Baptiste
Baptiste el 11 de Mzo. de 2024
Hi ! I took a look on those links but I'm still in the fog because I don't see how useful is the .dll file here while you call directly the library...
So here a resume :
1) From a project in another folder, whee the are already a complete and working project, I generated a c++ dll file using a visual dll project, let's call it "Lena.dll"
2) I create another folder for matlab simulink and create "lena.c" with the S-functions calling the c++ functions I know from the project, and "MexLena.m" where there are the following lines :
mex -v -g Lena.c Lena.lib
3) I put "Lena.dll" in the same folder than "Mexlena.m"
---> Don't work ! It request the Lena.lib
4) So I move Lena.lib in the folder :
---> Don't work ! It request the headers of the projec.
5) I move the headers, but I think seriously that normally, only the dll must be enought to work for the software
---> Work !
6) Delete the dll to see if I really use the dll file
--> Work too, so I don't use the dll in fact....
What to do to use the dll without moving the library and the headers from the other folder ? :/
Where I do the misstep ? At 4) ?

Iniciar sesión para comentar.

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by