Specifics for Using MinGW64 with Mx

1 ビュー (過去 30 日間)
Raziel Haimi-Cohen
Raziel Haimi-Cohen 2016 年 4 月 4 日
コメント済み: Helen 2016 年 7 月 29 日
I have an extensive set of Mex functions which I use in Linux and Windows. The build environment uses GNU Make file which are run from a shell command line (In Windows I use Cygwin as my shell). The build process involves compilation into object files, packing object files into static libraries and linking objects and libraries into Mex executables. I use arguments to the make file to control the type of build (debugging or optimized, with or without GPU, etc.), where for each build configuration the objects, library and executable files are place in separate directories.
I recently installed Matlab version R2016a and I would like to try to build my Mex software with the MinGW compiler. Before I start making the changes, I would like to check a few issues, regarding using the Mex/MinGW compiler on Windows:
1. Do object files created using the MinGW compiler have the extension of '.obj' or '.o'?
2. Which tool should I use to create static libraries of MinGW-generated objects? I have used the 'lib' program that comes with Microsoft Visual C++ when working with that compiler, but I am not sure that it will work correctly with MinGW. I have the 'ar' program which comes with Cygwin, and I wonder if MinGW comes with its own librarian program.
3. What is the file extension of Mex executables created with MinGW? Is it the same as for executable created with Visual C/C++/?
4. According to the documentation (<http://cens.ioc.ee/local/man/matlab/techdoc/apiref/themexscript.html)>: "On Windows, the options file is written in the Perl script language. The options file, mexopts.bat, is searched for in the following directories: the current directory first, then the same directory as mex.bat." I searched could not find any mexopts.bat in my Matlab file tree. Where can I find a default options file?
5. Is it possible to specify which compiler to use (Visual C/C++ or MinGW) in the mexopts.bat file? Which Perl statements should I use for that?
Thank you very much,
Raziel Haimi-Cohen
  1 件のコメント
Helen
Helen 2016 年 7 月 29 日
Q: 4. According to the documentation (<http://cens.ioc.ee/local/man/matlab/techdoc/apiref/themexscript.html)>: "On Windows, the options file is written in the Perl script language. The options file, mexopts.bat, is searched for in the following directories: the current directory first, then the same directory as mex.bat." I searched could not find any mexopts.bat in my Matlab file tree. Where can I find a default options file?
A. Please use the MathWorks documentation. http://www.mathworks.com/help/matlab/ref/mex.html

サインインしてコメントする。

採用された回答

Dave Behera
Dave Behera 2016 年 4 月 6 日
Hi Raziel,
Answers to your questions:
1. Do object files created using the MinGW compiler have the extension of '.obj' or '.o'?
A: .o files
2. Which tool should I use to create static libraries of MinGW-generated objects? I have used the 'lib' program that comes with Microsoft Visual C++ when working with that compiler, but I am not sure that it will work correctly with MinGW. I have the 'ar' program which comes with Cygwin, and I wonder if MinGW comes with its own librarian program.
A: There is a 'ar' command in MinGW that can help with this: http://stackoverflow.com/questions/10774937/statically-linking-libraries-in-mingw
3. What is the file extension of Mex executables created with MinGW? Is it the same as for executable created with Visual C/C++/?
A: same as for executable created with Visual C/C++/.
4. According to the documentation (<http://cens.ioc.ee/local/man/matlab/techdoc/apiref/themexscript.html)>: "On Windows, the options file is written in the Perl script language. The options file, mexopts.bat, is searched for in the following directories: the current directory first, then the same directory as mex.bat." I searched could not find any mexopts.bat in my Matlab file tree. Where can I find a default options file?
5. Is it possible to specify which compiler to use (Visual C/C++ or MinGW) in the mexopts.bat file? Which Perl statements should I use for that?
A: To select a compiler, use the command:
mex -setup

その他の回答 (0 件)

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by