ksherlock / mpw

Macintosh Programmer's Workshop (mpw) compatibility layer
239 stars 21 forks source link

Create SIOW app with mpw? #67

Open petersieg opened 11 months ago

petersieg commented 11 months ago

This is more a question. In original mpw, one can generate a SIOW type program, that basically opens a text window with menue items and the code can use printf and scanf I/O. So simple console type programs/C source can be compiled like that within Mac OS9/mpw.

Can this same behavior archived in mpw as well and if yes, how can that be done?

Many thx, Peter

ksherlock commented 11 months ago

If you want to build an SIOW application that should work. You need to link with {Libraries}/SIOW.o (listed before MacRuntime.o and rez {RIncludes}/SIOW.r

The building and Managing Programs in MPW Chapter 15 goes over it.

Bldg & Mng Progs in MPW 2ed.pdf

petersieg commented 11 months ago

Hi. If have tried, but get errors: Rez -rd SIOW.r -o bin/hello.68k -i ~/mpw/Interfaces/RIncludes -append /Users/ich/mpw/Interfaces/RIncludes/SIOW.r:909: ### Rez - Can't find the declaration for the resource type 'hmnu' (0x686D6E75). /Users/ich/mpw/Interfaces/RIncludes/SIOW.r:979: ### Rez - Can't find the declaration for the resource type 'hmnu' (0x686D6E75). /Users/ich/mpw/Interfaces/RIncludes/SIOW.r:1029: ### Rez - Can't find the declaration for the resource type 'hmnu' (0x686D6E75). /Users/ich/mpw/Interfaces/RIncludes/SIOW.r:1078: ### Rez - Can't find the declaration for the resource type 'hmnu' (0x686D6E75). /Users/ich/mpw/Interfaces/RIncludes/SIOW.r:1097: ### Rez - Can't find the declaration for the resource type 'hmnu' (0x686D6E75). /Users/ich/mpw/Interfaces/RIncludes/SIOW.r:1116: ### Rez - Can't find the declaration for the resource type 'hfdr' (0x68666472). /Users/ich/mpw/Interfaces/RIncludes/SIOW.r: ### Rez - Since errors occurred, ...

Source and Makefile attached. (A ppc app is created and can be started, but output goes into a file stdout)

Thx, Peter

test.zip

ksherlock commented 11 months ago

Don't use the modern rez, use the MPW version. mpw rez SIOW.r -o bin/hello.68k

petersieg commented 11 months ago

Hmm. Still doesn't work. No IO Window and file stdout is created. Test zip attached.

Thx, Peter test.zip

ksherlock commented 11 months ago

It's probably a subtle library link order issue.

I was able to make the 68k version run (in basilisk), based off the SIOW example from an ETO CD.

For 68k, the rez -append flag needs to be first and the library order is

"{CLibraries}"StdCLib.o
"{Libraries}"SIOW.o
"{Libraries}"IntEnv.o
"{Libraries}"MacRuntime.o
"{Libraries}"Interface.o

With those changes it executes correctly. For PPC, they list the library order as:

"{PPCLibraries}"PPCSIOW.o
"{PPCLibraries}"PPCCRuntime.o
"{SharedLibraries}"InterfaceLib
"{SharedLibraries}"StdCLib

SIOWExamples.zip

petersieg commented 11 months ago

Hi.

I tried your suggestions. hello.68k now opens a "SIOW" window, but no printout visible? hello.ppc still writes to file stdout and does not open any window. ?? The file hello.make is the one from real mpw running in os9. There all works as expected. (Window opened an print hello world in it)

Thx, Peter test.zip