Macintosh Programmer's Workshop

This page is a collection of my notes on using Macintosh Programmer's Workshop (MPW) and associated tools, such as the MrC and MrCpp compilers, which I have used since 2017. Unless noted otherwise, all notes assume the last versions of Mac OS 9, the MPW shell, and associated tools.

Bugs in MrC

Sometimes you may get a compiler warning that is an empty string. The cause may be one of the following:

The compiler may have trouble compiling code using variables of type long long or too complicated expressions, reporting internal errors. Breaking up code into more simple expressions will usually solve the problem.

Bugs in StdCLib

(StdCLib is the implementation of the standard C library for MrC and MrCpp.)

It seems that the fflush function may corrupt the file seek position. The workaround is to use fseek(file, SEEK_CUR, 0) instead.

Using SDL

To compile the SDL library (version 1.2.15, the last supporting Mac OS 9 and older):

  1. Install the OpenGL SDK. (One way to obtain it is from this mirror.) Copy the libraries and headers into the appropriate folders in your MPW installation.
  2. In MPW, execute Set -e CIncludes "{CIncludes},{CIncludes}OpenGL:" to let the compiler find the OpenGL headers. (You can also change this variable permanently if you are going to use OpenGL, but for the purpose of compiling SDL, it is not necessary to do so.)
  3. Follow the instructions in SDL's README.MacOS file. Note: by default, the library will be compiled without full optimizations. You can edit the makefile (SDL.make) and put -opt speed into the compiler options at the top.

To compile SDL applications, link with the produced SDL library and optionally SDLmain.o (unless you initialize the Macintosh Toolbox yourself). SDL requires that you use the -enum int compiler option. The compiled application will require the SDL library in its folder.

GUSI, Sfio, and other libraries

GUSI is a library providing implementations of several POSIX functions on Mac OS to ease porting software.

Sfio is an implementation of stdio.h functions that is required by GUSI when used with MrC and MrCpp. You can get it here and possibly elsewhere.

Using Free Pascal

The last version of Free Pascal for Mac OS and MPW is 2.0.4. (I have succeeded in compiling neither it nor a newer one.)

If you are using the MacOS unit in your Pascal program, give MPW at least a 32-megabyte memory partition.

If the path of your MPW installation contains spaces, linking a Pascal program will fail. The workaround is to either get rid of the spaces or the following:

  1. Compile your Pascal program with the -sh option.
  2. Edit the link.rel file and put quotes around the names of the object files.
  3. Execute the ppas script.

My MPW scripts and programs

Links


First published on .
Last updated on .

Table of contents

Contact me