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.
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.
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"