Loading Third party header files in matlab

I am working on a project in which i have to load .dll files generated by C++ into MATLAB code. the project is to interface third party device via USB. My header file include third party header file and MATLAB is giving error that Cannot open thirdparty.h file...any idea how to solve this error? I am using loadlibrary command to load dll and header file.

3 comentarios

Friedrich
Friedrich el 30 de Ag. de 2013
Can you post your loadlibrary command here? Where is the DLL and header file located? Keep in mind that loadlibrary works for native C style header files only.
Saad
Saad el 30 de Ag. de 2013
Editada: Saad el 30 de Ag. de 2013
loadlibrary CNanaoLambda.dll CNanoLambda.h
The above library and header files in turn depends on .dll and .h file of a third party. Third party .h file is written in C. This is the error
??? Error using ==> loadlibrary at 441 Failed to preprocess the input file. Output from preprocessor is:CNanoLambda.h D:\matlab_lightlamp\Light_lamp\CNanoLambda.h(7) : fatal error C1083: Cannot open include file: 'USBCommAdapter.h': No such file or directory
Where USBCommAdapter.h is third party header file.
Friedrich
Friedrich el 30 de Ag. de 2013
Editada: Friedrich el 30 de Ag. de 2013
When you run the above command the DLL and the all needed Header files must be your current folder. I assume that not the case. You need to pass down the folder where the needed header files are located. For that you need to use the -I (<=capital i) flag for mex. See the documentation for more information about that flag. Since the DLL depends on other DLLs you need to make them available to MATLAB by either copying them next to the CNanaoLambda.dll (which I wouldnt recommend doing) or by setting the PATH environment variable locally for your MATLAB by using the SETENV command.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre File Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Ag. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by