Technical Q&As


PLAT 13 - Stubs.o vs. fgets (1-June-95)


Q We have a problem with the MPW SIOW and Stubs.o libraries. A program ("Show_bug") linked without either of these libraries works properly (the test sequence is basically an 'fopen' followed by an 'fgets'), but if the Stubs.o or the SIOW.o library is linked into the program, either nothing is returned by the 'fgets', or a ZcbFree error occurs during a call to 'fprintf'.

The following list shows the target, the library that is linked, and the bug shown:

Target			Library	Bug

Show_bug		Stubs.o	the 'fgets' problem
Show_bug_NAKED	---		works as expected
Show_bug_SIOW		SIOW.o	ZcbFree error during fprintf


A The Stubs.o library is intended for use in building MPW Tools, but the make file that you are using is building an application. Changing that to an MPW Tool should solve your problem. For a brief discussion of 'Stubs.o', see page 9-4 of Building and Managing Programs in MPW.

The SIOW library is intended for use in applications that perform simple I/O to a console. SIOW cannot be used with an application that opens windows. There is a warning to this effect on page 6-3 of Building and Managing Programs in MPW.

With regard to your Naked build, you should not be making calls to 'fgets' or 'fprintf' using stdout and stderr from within a "Mac-like" application, as indicated by the warning given in two of the dialogs put up by your Naked application.

Technical Q&As
Previous Question | Contents | Next Question