Borrar filtros
Borrar filtros

Specifics for Using MinGW64 with Mx

2 visualizaciones (últimos 30 días)
Raziel Haimi-Cohen
Raziel Haimi-Cohen el 4 de Abr. de 2016
Comentada: Helen el 29 de Jul. de 2016
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 comentario
Helen
Helen el 29 de Jul. de 2016
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

Iniciar sesión para comentar.

Respuesta aceptada

Dave Behera
Dave Behera el 6 de Abr. de 2016
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

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by