How to load a c++ dll file into Matlab

Rolf Anders picture Rolf Anders · Feb 19, 2009 · Viewed 12.1k times · Source

I have a C++ dll file that uses a lot of other c++ librarys (IPP, Opencv +++) that I need to load into matlab. How can I do this?

I have tried loadlibrary and mex. The load library does not work.

The mex finds the linux things (platform independent library) and tries to include them. And that does not work.

Does anyone have any good ideas?

Answer

Dima picture Dima · Feb 19, 2009

loadlibrary should work. I use it all the time to call functions from dlls written in C++ with C wrappers.

What errors are you getting when you try to use loadlibrary?

Make sure that the exported functions of the dll are C functions, not C++ functions. If not, then write C wrappers.

More info on exactly what you are doing when using loadlibrary would be helpful.