Hi. I will have to load an DLL file into Matlab but I do not have a dll header file. Could someone please give some examples of how to build such header file?

 채택된 답변

Sudhanshu Bhatt
Sudhanshu Bhatt 2015년 11월 9일

0 개 추천

Hi George Alin Raducu,
Unfortunately, it is not possible to load a DLL into MALTAB, without a header file. More information on this can be found in the thread below:
Below are some resources that will help you create a MATLAB function into a C/C++ Shared DLL:
Information on how to integrate the C/C++ Shared Library into your application:
Also, there are some limitations to Shared Libraries integration with MATLAB:
Hope this helps!
Thanks
Sudhanshu Bhatt

댓글 수: 1

Hi,
Thank you very much for your information. I tried to build my own header file and create an S-function in order to load the DLL but I when I'm running the simulation I get only NULL outputs. I guess that I'm doing something wrong therefor I attach my header and c files. Would be great If someone could comment on these files.
Thank you very much!!

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

추가 답변 (1개)

Madison Radford
Madison Radford 2026년 10월 26일 20:54

0 개 추천

As Sudhanshu mentioned, it is not possible to load a DLL into MATLAB without a header file.
If you want to generate a C/C++ library from a MATLAB function that includes both a DLL and a header file, see C Shared Library Integration and C++ Shared Library Integration.
As of MATLAB R2022a, the recommended way to call functions in C and C++ libraries is to publish a MATLAB interface to the library. For more information, see Call C/C++ from MATLAB.
If you are using MATLAB R2021b or earlier, you can load functions from a C shared library. For more information, see Call C from MATLAB.
Note that both of these methods require a header file.
There are some limitations to Shared Libraries support in MATLAB, which is why we recommend you use a MATLAB interface to the library.

카테고리

도움말 센터 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

질문:

2015년 11월 5일

답변:

2026년 10월 26일 20:54

Community Treasure Hunt

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

Start Hunting!

Translated by