Specifics for Using MinGW64 with Mx
2 次查看(过去 30 天)
显示 更早的评论
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
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?
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!