Skip to content
Advertisement

Run matlab compiled dll library from a C program on Linux/OSX

So I have a .dll file that was built via Matlab on Windows and I would like to run it on a C/C++ program I’ve created. Is that possible at all?

I know I can run it on windows like this:

#include <windows.h>
...
HINSTANCE hinstLib;
hinstLib = LoadLibrary(TEXT("MyPuts.dll"));
...

But windows.h is not available on Linux/OSX, is there any other way?

Alternatively is there any other format I can build the Matlab library in? Maybe .so is that an option?

Advertisement

Answer

I do think that would be problamatic. As the Wauzl comment suggest you should compile it to .so if possible. Another option would be to run the entire program compiled for windows under wine.

I havent checked out winelib myself, but maybe it might be worth a look Winelib guide

Winelib is a development toolkit which allows you to compile your Windows applications on Unix.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement