简体   繁体   English

从Linux / OSX上的C程序运行matlab编译的dll库

[英]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. 因此,我有一个通过Windows上的Matlab生成的.dll文件,我想在我创建的C / C ++程序上运行该文件。 Is that possible at all? 那有可能吗?

I know I can run it on windows like this: 我知道我可以在这样的Windows上运行它:

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

But windows.h is not available on Linux/OSX, is there any other way? 但是windows.h在Linux / OSX上不可用,还有其他方法吗?

Alternatively is there any other format I can build the Matlab library in? 另外,还有其他格式可以建立Matlab库吗? Maybe .so is that an option? 也许.so是一个选择吗?

I do think that would be problamatic. 我确实认为这是有问题的。 As the Wauzl comment suggest you should compile it to .so if possible. 正如Wauzl的注释所建议,如果可能,应将其编译为.so。 Another option would be to run the entire program compiled for windows under wine. 另一种选择是在wine下运行为Windows编译的整个程序。

I havent checked out winelib myself, but maybe it might be worth a look Winelib guide 我还没有亲自检查过winelib,但也许值得一看Winelib指南

Winelib is a development toolkit which allows you to compile your Windows applications on Unix. Winelib是一个开发工具包,它使您可以在Unix上编译Windows应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM