MATLAB: Does the ‘addheader’ option fail to work with the generic DLL in MATLAB 7.0 (R14)

addheaderloadlibraryMATLAB

I have created a shared library from C-code to be used with MATLAB’s generic DLL interface. For example, I have compiled a shared library named mylib.dll with header files mylib1.h and mylib2.h. I am trying to load the library with the following command:
loadlibrary(mylib.dll,mylib1.h,addheader,mylib2.h)
This loads the library without complaint, but I am able to use only the functionality that is prototyped in the first header file.

Best Answer

The LOADLIBRARY command will not scan multiple header files, even if the 'addheader' option is used. The 'addheader' option's intended use is to load the functions from the specified file. For example, if the library functions are prototyped in header1.h and header2.h, to load the functions from both header files you would need to include the following line in header1.h:
#include "header2.h"
You would then use the 'addheader' option as follows:
loadlibrary(mylib.dll,header1.h,addheader,header2.h)