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
-O2
task.c
-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 "gccopts.sh"
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 mexopts.sh in order to include the "-framework" compiling option.
CC='gcc-3.3'
CFLAGS='-fno-common -no-cpp-precomp -fexceptions'
CLIBS="$MLIBS -lstdc++ -framework nidaqmxbase -framework nidaqmxbaselv -framework 'LabVIEW 8.0 Runtime'"
COPTIMFLAGS='-O3 -DNDEBUG'
CDEBUGFLAGS='-g'
#
# g++-3.3 -v
# gcc version 3.3 20030304 (Apple Computer, Inc. build 1435)
CXX=g++-3.3
CXXFLAGS='-fno-common -no-cpp-precomp -fexceptions'
CXXLIBS="$MLIBS -lstdc++ -framework nidaqmxbase -framework nidaqmxbaselv -framework 'LabVIEW 8.0 Runtime'"
CXXOPTIMFLAGS='-O3 -DNDEBUG'
CXXDEBUGFLAGS='-g'
#
The command line used to compile the mextask.c file is:
mex -I"/Applications/National Instruments/NI-DAQmx Base/includes"
mextask.c

  0 Comments

Sign in to comment.

More Answers (0)

Products


Release

R14SP3