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

조회 수: 31 (최근 30일)
carpetfizz
carpetfizz 2019년 10월 15일
댓글: Baptiste 2024년 3월 11일
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!

답변 (1개)

Maadhav Akula
Maadhav Akula 2019년 11월 4일
  댓글 수: 1
Baptiste
Baptiste 2024년 3월 11일
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) ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by