Porting Code to the BeOS
Volume Number: 13
Issue Number: 1
Column Tag: Betechâ„¢
Porting Code to the BeOS
By Michael Rutman, independent consultant
A look at how developing for the BeOS differs from other
platforms
The BeBox and the Macintosh Developer
I was curious what would happen if a BeBox was dropped on my desk and I was told,
"This is the platform we want all our software running on - make it so." As a
Macintosh developer, would this be the end of the world as I know it, or would it be a
smooth transition as enjoyable as MacOS 8.0 was expected to be?
Despite my love for Macintosh, there is tons of free software for Unix and dos that I
would love to port to Macintosh, but porting Unix software to Macintosh has always
been difficult. Each time I tried it was very painful. The BeOS claim to support Unix
software was intriguing, so I decided I would port some Unix code as well as Macintosh
code to the BeOS.
I've had the BeBox for a week now, and I have had a good time with it. Playing with it
has made me think a lot about the BeOS and how it would fit into a Macintosh
developers' life. The Macintosh user experience, especially for developers, has always
been important. This article describes my experiences setting up the BeBox, porting
Unix code, and the steps I would need to take to port Macintosh code.
Getting Started
Begave me a BeBox all ready to go. All I needed to do was plug it in and start porting
code to it. However, setting it up proved to be an interesting experience. The BeBox has
24 ports on the back, not including the 3 on cards, and none of them are labeled.
Normally, I can guess a port by the number of pins, but the BeBox supports every port
I can think of, and some that I have never heard of before, and several of them look
identical.
There is a nice diagram in the User Manual to identify each port; I recommend you
make sure you never lose the User Manual. Once you have the diagram, hooking up the
BeBox is just plug and play. In fact, the manual says that the BeBox will automatically
detect such things as the mouse plugged into a port, and configures itself to use that
port. Having once had to set up a Windows machine, I appreciate Be's effort at making
it easy to set up their computer.
All of the BeOS preference applications are in one folder, and each preference is in a
well named application. Contrast that with whenever I need to configure my Macintosh,
I never seem to know exactly where to find the correct configuration panel. I didn't
have that problem with the BeOS. On the other hand, I spent over an hour configuring
the BeOS until things worked, and I am still having some problems with the Ethernet.
It's never taken me that long to get any Macintosh configured, except when MacTCP was
first released. Overall, configuring the BeOS was in some ways easier than configuring
a Macintosh, in other ways more difficult.
Once I had everything set up and ready to go, the applications worked as I would expect.
I was able to find several shortcuts by just trying things. The shortcuts I found were
nicely done. If you are used to Macintosh shortcuts, then you won't be disappointed by
the BeOS shortcuts. They implemented many of the Macintosh shortcuts, and the new
shortcuts they have introduced make sense and work well. They did miss
command-clicking a window title to get a path, but that was the only shortcut I
regularly use that the BeOS did not implement.
I must say that the BeOS is not Macintosh, and I doubt it ever will be confused with
Macintosh - but on its own merits, I must say that the BeOS is nice. I am using DR8,
which, near as I can tell, is 2 releases away from 1.0. Having used NeXTSTEP at 0.8,
and seen how much NeXT cleaned it up for 1.0, I expect future versions of the BeOS to
be very nice, but it is as yet unfinished. There is very little that "doesn't work," and
much of it works well. In many ways, it's an improvement over other GUI's that are
already shipping, but not much of its UI is revolutionary.
About the Development Environment
Metrowerks, on their CodeWarrior 10 CD, provides tools to cross-compile Be
applications on your Macintosh. You can even do remote debugging over the network.
However, Metrowerks also ported their IDE to the BeOS, and the BeIDE is included with
the BeOS.
You can also use the compiler from the command line. Make is supported, as is calling
the compiler directly. You can edit your files under the BeOS using their low end
graphical editor called Edit. After using Edit, though, I recommend using CodeWarrior.
The command line make uses mwcc and mwld. The mwld shipped with the BeOS is a
demo limited to 64K applications. This limit prevents anything useful from being
created, but the commercial linker from Metrowerks will work from the command
line. You will have to copy a folder from your CodeWarrior CD to the BeBox and place
the new linker in the correct place. If you unzip the folder from the root volume, it
should install automatically in the correct place for you. I used ftp, but later versions
of the BeOS, I'm told, will be able to read Macintosh CD-Roms.
If you have Metrowerks CodeWarrior 10, then you have the full Be development
environment. However, Metrowerks will no longer be including the Be development kit
on their CodeWarrior CD. You will have to buy it from Metrowerks for $299/year;
currently discounted to $149 if you act now.
If you know how to program in NeXTSTEP, the Be operating system will seem very
familiar. Most of the people I met at Be were NeXTSTEP programmers at one time or
another. There is a lot in Be's framework that other framework developers should look
at. Again, I didn't see anything revolutionary over NeXTSTEP, but it's the first time
I've seen a really good framework written in C++.
A Simple Port: Unix Code
The BeOS has a mini-Unix environment to make porting Unix code to the BeOS easier.
The theory, according to Be, is that you only need to unpack the source code, cd to the
directory, and type make. I thought this would be a quick, easy test of the development
environment. I attempted to port tf, a mud client. Unfortunately, it needed a bit more