Filter löschen
Filter löschen

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

38 Ansichten (letzte 30 Tage)
carpetfizz
carpetfizz am 15 Okt. 2019
Kommentiert: Baptiste am 11 Mär. 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!

Antworten (1)

Maadhav Akula
Maadhav Akula am 4 Nov. 2019
  1 Kommentar
Baptiste
Baptiste am 11 Mär. 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) ?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by