MATLAB Answers

How can I pass the GCC "-framework" compiling option to the MEX compiler on Mac in MATLAB 7.1 (R14SP3)?

45 views (last 30 days)
In Mac OS X, from a Terminal window, I can compile a C-file called task.c with the following options and flags:
gcc -I../../includes
-framework nidaqmxbase
-framework nidaqmxbaselv
-framework "LabVIEW 8.0 Runtime" -o task
Assuming that I modify task.c to have a proper MEX-wrapper to create mextask.c and make GCC my comiler through "mex -setup", I would like to know the equivalent compiling command for the above, particularly the equivalent to the "-framework" options.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
NOTE: The following solution has not been tested and modifications to options files are not officially supported by MathWorks.
The "-framework" option is not built into the MEX compiler. In order to use it, you will need to modify the MEX options file to control compiler options. Following are the steps to locate the MEX options file.
1. Execute
mex -setup
to select the desired compiler.
2. The full path where the options file is located is displayed in the output of mex -setup. An example options file is ""
3. Adjust the lines to set the compilation flags and the linking flags, in order to pass the -framework option to the compiler/linker.
Following is an example of the modifications made to in order to include the "-framework" compiling option.
CFLAGS='-fno-common -no-cpp-precomp -fexceptions'
CLIBS="$MLIBS -lstdc++ -framework nidaqmxbase -framework nidaqmxbaselv -framework 'LabVIEW 8.0 Runtime'"
# g++-3.3 -v
# gcc version 3.3 20030304 (Apple Computer, Inc. build 1435)
CXXFLAGS='-fno-common -no-cpp-precomp -fexceptions'
CXXLIBS="$MLIBS -lstdc++ -framework nidaqmxbase -framework nidaqmxbaselv -framework 'LabVIEW 8.0 Runtime'"
The command line used to compile the mextask.c file is:
mex -I"/Applications/National Instruments/NI-DAQmx Base/includes"


Sign in to comment.

More Answers (0)