• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.AppleDouble/H03-May-2022-

.FBCLockFolder/H03-May-2022-

-MacReadMeH A D16-Oct-20213.1 KiB2313

Makefile-linuxH A D16-Oct-2021808 4026

Makefile-ml6-linuxH A D16-Oct-2021809 4026

Makefile-osxH A D16-Oct-2021821 4026

Makefile-solarisH A D16-Oct-2021817 3926

Makefile-sun4H A D16-Oct-2021796 4026

convolve.cH A D16-Oct-202110.3 KiB326244

convolve.hH A D16-Oct-20211.8 KiB5637

corrDn.cH A D16-Oct-20214.5 KiB152102

corrDn.expH A D16-Oct-202143 32

edges-orig.cH A D16-Oct-202116 KiB495318

edges.cH A D16-Oct-202121.6 KiB648466

histo.cH A D16-Oct-20214 KiB141108

innerProd.cH A D16-Oct-20211.4 KiB5339

pointOp.cH A D16-Oct-20213.4 KiB12797

range2.cH A D16-Oct-20211.4 KiB5739

upConv.cH A D16-Oct-20216.1 KiB196145

wrap.cH A D16-Oct-20218.2 KiB282195

-MacReadMe

1MacReadMe
2How to compile a MEX file for Macintosh
3(Based on a similar note written by David Brainard and Denis Pelli to accompany the Psychophysics Toolbox.)
4
5A MEX file (short for "MATLAB extension") contains code that implements a new MATLAB function, allowing users to use the full power of the C language and the Macintosh hardware and operating system in implementing a new MATLAB function. This document explains how to produce a MEX file that is "fat" (i.e. will run as native code on both 68K and PowerPC Macs) and is compatible with both MATLAB 4 and 5.
6
71) To produce a MATLAB MEX file with PowerPC code you must have the Metrowerks CodeWarrior C compiler (version 10 or better, abbreviated as CW below). To produce 68K code we still use the Symantec THINK C compiler (version from Symantec C++ 8 CD-ROM release 5), but we will soon be switching to Metrowerks CodeWarrior. (See note A below.)
8
92) Place a copy of the MATLAB 4:Extern folder, supplied by Mathworks, on your compiler's search path. We suggest that you name the copy "MEX V4". (See notes B and C, below.)
10
113) Build any of the MEX files simply by opening its project file and asking your compiler to "Build Code Resource" (in THINK C) or to "Make" it (in CW).  For each MEX file, e.g. histo.mex, there are two associated projects, e.g. histo.� for CW, and histo.�.4 for THINK C. To build a "fat" MEX, that runs native on both 68K and PowerPC, you should first compile in THINK C, and then in CW. (See note A, below.)
12
13Denis Pelli
14April 2, 1997
15
16Notes
17
18A) The Mathworks support only the THINK C compiler to make 68K MEX code for MATLAB version 4 and only the CW compiler to make PPC MEX files for MATLAB 4 and both 68K and PPC for MATLAB 5. This archive includes THINK and CW projects. To build a fat MEX file for MATLAB 4, first "make" the THINK C version (e.g. histo.�.4), producing a file with a .rsrc extension (e.g. histo.�.rsrc). This is the 68K MEX file. When you then "make" histo.�, the CW project incorporates the .rsrc file and generates a "fat" MEX file that will run native (i.e. fast) on both 68K and PowerPC. To make a 68K-only MEX file, simply rename, e.g., histo.�.rsrc to histo.mex after you make the THINK project, and set the file type and creator to match the other MEX files. THINK C is slow and hard to work with. Symantec hasn't significantly upgraded in it many years. There is an error in the math.h header (version from Symantec C++ 8 CD-ROM release 5). We fix that error by some tricky preprocessor defines and undefines in the THINK C Prefix in each of the THINK projects.
19
20B) The easiest way to put a folder on your compiler�s search path is simply to put the folder in the same folder as the compiler itself. If you want to use both CW and THINK C, then put the folder under CW, make an alias of it, and put the alias in THINK C's "Aliases" folder.
21
22C) Happily, MATLAB 5 is capable of running both V4 and V5 MEX files. Thus we are currently distributing sources that compile into V4 MEX files. The resulting MEX files run both under V4 and V5. In the future we will drop support for V4 and THINK C. (See note A above.)
23