This is MACH-NT-4.2.txt in view mode; [Download] [Up]
//-----------------------------------------------------------------------------
// MiscTableScroll OPENSTEP 4.2 for Mach and NT Port
// $Id: MACH-NT-4.2.txt,v 1.6 97/06/18 09:33:43 sunshine Exp $
//-----------------------------------------------------------------------------
This file describes the changes to MiscTableScroll needed to get it to
compile under OPENSTEP 4.2 prerelease and final release for both Mach and NT.
OPENSTEP 4.2 is the first release of OPENSTEP for NT which has a compiler
(gcc 2.7.2.1) which supports Objective-C++, so it is the first release which
can compile MiscTableScroll for NT.
While performing this port bugs were discovered in the OPENSTEP 4.2
prerelease Objective-C++ compiler, makefiles, and headers. All of these bugs
have been reported to NeXT. A few of them have been fixed, but most still
remain in the final release of 4.2. In order to support 4.2 and consequently
NT, I had to work around some particularly serious problems, but fortunately
was able to do so without seriously compromising the integrity of the code,
even while continuing to support 4.1.
It is particularly unfortunate and obnoxious that one of the most serious
bugs -- a compiler crash when sending a message to 'super' from within a
category -- still exists in the final release of 4.2 for NT even though it
was fixed for Mach. What is so odd about this is that NeXT *did* fix the bug
in both the the Mach and NT compilers. I know this because NeXT sent the
patched compiler to me for both platforms during the prerelease period and I
verified that it was indeed fixed. I am at a loss as to why they failed to
ship 4.2 for NT with the fixed compiler.
//=============================================================================
Following is a list of changes which were required to port MiscTableScroll to
OPENSTEP 4.2 for both Mach and NT.
- Added a file named new.h to the Framework source directory. It contains:
-------------------- new.h --------------------------------------------
inline void* operator new( size_t, void* ptr ) { return ptr; }
-----------------------------------------------------------------------
This file is required on Mach since NeXT did not supply a <new.h> at all.
In the past, <new.h> was located in the g++ header directory, but NeXT
did not ship libg++ with 4.2 for Mach. I reported this bug to NeXT on
04/03/97 and it was registered as tracker #78207.
This file is required on NT since the <redist/new.h> file which NeXT
redistributed from Microsoft tries to include the non-existent file <new>
and is missing the default placement new operator as well. I reported
this bug to NeXT on 03/28/97 and it was registered as tracker #78067.
Fortunately adding a local new.h file gets around both of these problems
without compromising support for OPENSTEP 4.1.
- Switched from -Wall to -Wmost since the OPENSTEP 4.2 compiler generates
warnings which the programmer can not sensible do anything about when
-Wall is used. An example of common code which results in a useless
warning is illustrated below:
- (void)buttonPressed:(id)sender {} // Warning: usused 'sender'
I reported this bug to NeXT on 03/31/97 and it was registered with
tracker #78071. On 04/07/97 NeXT responded by saying that they will not
fix it for 4.2 and that it *might* get fixed in 5.0 (but we've heard that
before).
- Had to add a rule to Makefile.postamble to handle bad code generated for
psw files. For some unknown reason pswrap generates an unused 'pad'
variable which result in compiler warnings. I reported this bug to NeXT
on 04/01/97 and it was registered with tracker #78091. I worked around
this problem by running the source file generated by pswrap through a sed
script which deletes the useless 'pad' variable altogether.
- Reorganized the code to avoid calls to 'super' from within categories since
such calls crash the OPENSTEP 4.2 prerelease Objective-C++ compiler for
Mach and NT, as well as the OPENSTEP 4.2 final release compiler for NT.
This is an extremely serious problem.
I worked around this problem by supplying methods in the main
(non-category) implementation which simply forward the appropriate
message to 'super'. Categories call these methods rather than calling
'super' directly. Though ugly, it's simple, very localized, and can be
easily undone when/if NeXT fixes the problem.
I reported this bug to NeXT on 03/31/97 and it was reigstered with
tracker #78005. On 04/08/97 they sent me a patched Mach compiler in
which this bug had been fixed. On 04/21/97 they sent a patched NT
compiler. What is particularly mind-boggling is that although they fixed
it on both platforms, they neglected to include the patched compiler in
the final release of OPENSTEP 4.2 for NT even though they did include it
in the final release of OPENSTEP 4.2 for Mach. Go figure.
- Changed all assert() calls to NSAssert() variations for a couple reasons.
The file <redist/assert.h> which NeXT redistributed from Microsoft
declares _assert() as accepting non-const buffers (void*) rather than
const (char const*), and therefore generates a warning. I reported this
bug to NeXT on 03/28/97 and it was registered with tracker #78068.
NSAssert() is more portable and it throws exceptions which can be caught
by the application in the event that it needs to log the error somewhere
other than the default error log.
- Moved -Werror and -Wwrite-strings out of the Makefile.preamble and into the
PB.project. This allows greater flexibility when trying to handle
differences between platforms since the flags can be customized on a
per-platform basis rather than across all platforms.
- MiscExporter no longer sends -makeKeyAndOrderFont: & -close messages to the
NSSavePanel since the NSSavePanel in OPENSTEP for NT, does not respond
to these messages.
- Worked around "dllimport'ed value used as initializer" error in delegate
notification code in MiscTableScroll.M under Windows NT. It was using
notification messages exported from the AppKit.dll in a static table.
- MiscDelegateFlags.h now includes <Foundation/NSObject.h> rather than
<objc/objc.h> since the OPENSTEP 4.2 prerelease compiler couldn't grok
the keyword 'class' following inclusion of <objc/objc.h>. I have not
examined objc.h yet to determine why it was causing this problem. At any
rate, NSObject.h is more portable than objc.h across OpenStep
implementations.
- Had to add "OTHER_CCFLAGS += -ObjC++" to Makefile.preamble in order to
allow .cc files to include Objective-C headers and reference Objective-C
code. I suppose that the NeXT makefiles rules are correct in the strict
sense since they do not use -ObjC++ for cc files automatically. However,
this means that pretty much all of our projects will require the addition
of this line to the Makefile.preamble. It might just be a better idea
for NeXT to fix it *once* in their makefiles or to designate a file
extension which stands for "C++ code which includes Objective-C code".
I'm not sure what the correct approach is, though I made a number of
suggestions when I reported this problem to NeXT on 04/03/97. Their
response on 04/07/97 indicates only that there is some internal confusion
and that they will "get back" with me on it. [06/18/97 - I still haven't
heard back from them, and indeed, the "internal confusion" has failed to
diminish even in the final release of 4.2.]
- Had to conditionalize the setting of OTHER_OFILES in the Makefile.preamble.
Setting OTHER_OFILES was a patch to work around bugs in the OPENSTEP 4.1
and OPENSTEP 4.2 prerelease makefiles which neglected to include any of
the .o files from C++ sources. This problem was fixed in the final
release of OPENSTEP 4.2, but the patch is still needed for support of
4.1, hence the conditional.
- Now that (bool) is a built-in type, had to remove @encode(bool) from
MiscTableBorder during archiving and unarchiving since @encode(bool)
returns "" in the OPENSTEP 4.2 (gcc 2.7.2.1) compiler. This causes the
archivers to raise an exception. I now translate the (bool) into a
(char) during coding. This also keeps it compatible with the pre-4.2
faked-up MiscTableScroll (bool) which was just a typedef to (char). I
reported this bug to NeXT on 04/03/97 and it was registered with tracker
#78228.
- Broke the project into Framework and Palette subprojects which are now
contained within a top-level aggregate project. This allows the example
applications to link correctly by avoiding the following problems:
Problem 1: Previously, the Makefile.postamble was creating an 'ld -r'
style object file under Mach but this type of object file creation
does not seem to be available under Windows.
Problem 2: Couldn't convert it to a real library because Windows doesn't
have the equivalent of -all_load (that I could find), and
consequently unreferenced symbols were not being linked in.
This also allowed me to remove the MiscBorderViewInline.M hack which
contained hard-coded HEX dumps of the tiff images. Now the image
resources are contained within the Framework.
- Renamed the executable (dll) file within the Palette to avoid name
collision with the executable (dll) file within the Framework.
This showed up as a bizarre problem in +[NSBundle load] which kept
erroring out so long as the dll files from the Framework and Palette had
the same name even though they were contained in *different* directories.
I don't know if this is a bug in the Microsoft dll loader or the
Objective-C run-time.
I worked around it by renaming the palette executable to
MiscTableScrollPalette while leaving the wrapper as
MiscTableScroll.palette. This was accomplished with a little Makefile
magic (redefining INNER_PRODUCT) and by overriding "NSExecutable" via a
CustomInfo.plist.
I have not reported this problem to NeXT.
//=============================================================================
v0.125.9 06/18/97 09:00 EDT sunshine
Ported to OPENSTEP 4.2 final release for Mach and NT.
Required permanent work-around for "sending message to 'super' bug" since
it still exists in Objective-C++ compiler for NT.
Required work-around for unused 'pad' variable in pswrap generated source.
Added permanent local new.h file to combat missing <new.h> on Mach and
buggy <redist/new.h> on NT.
v0.125.8 04/15/97 10:00 EDT sunshine
Broke into Framework and Palette subprojects.
Worked around +[NSBundle load] problem where it couldn't load the Palette
dll file because it had the same name as the Framework dll file, d'oh!
v0.125.7 04/09/97 03:00 EDT sunshine
Now creates a library under NT as well.
v0.125.6 04/04/97 02:30 EST sunshine
Ported to OPENSTEP 4.2 prerelease for Mach.
v0.125.5 03/31/97 16:30 EST sunshine
Ported to OPENSTEP 4.2 prerelease for NT.
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.