MEX for different platforms - deployment question.

조회 수: 10(최근 30일)
Arwel
Arwel 2019년 3월 20일
편집: Walter Roberson 2019년 3월 20일
HI,
I have some software than will be used by different members of a team. Everyone has matlab, but annoyingly on different platforms (i.e. Linux, Win and OSX).
There is some fortran mex involved, which compiles without problem on Linux, but annoyingly we don't have compatible Fortran compilers on Windows (or MAc, but that's probably in Xcode somewhere I guess).
My question is can you use mex to compile for different targets? So on the linux machine (gfortran) it makes xxxx.mexa64, is it possible to get it to make xxxx.mexw64 and xxxx.mexmaci with some switch or something?
I have coder, but don't see how that would help because the source is Fortran.
My third option would be maybe to build the Fortran as a shared library in each case and try 'loadlibrary' maybe?
So basically, I'm developing on Linux, the code needs a Fortran mex but I need to be able to deploy on Mac and Windows also. What's considered best practice for this kind of thing?
Cheers,
Arwel

답변(1개)

Walter Roberson
Walter Roberson 2019년 3월 20일
No; you have to compile on a compatible system. The only cross-compilation support that existed historically was that you used to be able to target Windows 32 bit systems while running on Windows 64 bit.
On Linux you just might be able to work something out involving Vine or similar to run Windows in parallel, but it would probably be a nuisance.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by