MATLAB: Does the generic C++ DLL not load properly in MATLAB 7.1 (R14SP3)

MATLAB

When I load my C++ library that is built using MSVC .NET 2003, using LOADLIBRARY, I get the following warning messages:
Warning: The function 'my_dll_fun' was not found in the library
> In loadlibrary at 246
When I use LIBFUNCTIONS, I get the following error:
No methods for class lib.pixci_api or no class lib.pixci_api.

Best Answer

In order to use a generic C++ DLL in MATLAB, you need to wrap the functions in the source and header file with extern "C".
To do this, wrap the extern function prototypes with the following code:
#ifdef __cplusplus
extern “C” {
#endif
...
#ifdef __cplusplus
}
#endif