Dear FB fellow coders,
just back from an official "Apple Developer Connection" (ADC)
workshop on "Universal Applications" I should like to communicate my
still fresh impression and understanding of some crucial facts,
especially with respect to the (future) of the FB-IDE (FutureBASIC
Integrated Development Environment).
Apple never before has organized such worldwide and free workshops
dealing with technical details for developers. The reason for this
change of mind essentially is that Apple will finish the transition
to Intel-based hardware earlier than originally (June 2005) planned,
namely at the end of this year instead of 2007. Consequently, the
temporal horizon for "native" software has changed as well...
During the workshop all presentations were given by Paul Burford, an
ADC expert from Apple/UK.
Some facts:
(1) From now on, all applications are to be so-called "Universal Binaries".
-- A "Universal Binary" is a code package similar to OSX bundled
applications but containing an Intel- _and_ a PowerPC (PPC)-version
of the code. Of course it contains resources, help-files and the like
that are accessed by both code versions. Because of the latter,
Universal Binaries are much smaller than twice the size of the
respective PPC apps. (Actually, Universal Binaries may contain many
more code versions, such as up-coming Intel 64bit or -- for special
non-GUI apps -- PPC 64bit versions.)
-- Apple depreciates to compile Intel-only apps.
It appears that -- although this is mainly due to the fact that Apple
doesn't want to puzzle a user who transfers software from an Intel to
an PPC Mac -- Apple on the long run wishes to use processors of their
choice... (Remember that Apple's transition to Intel CPUs was mainly
due to the fact that no adequate PPC CPUs for _laptops_ were
available!)
-- The technique underlying the Universal Binaries is quite old and
dates back to the first half of the 1990 when NEXT developed the then
called "FAT applications" that did run on _four_ different platforms.
-- Both code portions of Universal Binaries must be Mach-O compiled.
(Presently, FB compiles CFM/PEF for PPC only.)
-- Presently, there are only _three_ compilers that generate Mach-O
code for Intel, namely ggc4 that is part of Xcode 2.2 and the brand
new C(++)/FORTRAN compilers from Intel. (BTW, the code produced by
the Intel C-compiler is (slightly) better than that produced by ggc4.
Xcode 2.3 will be available in a few weeks from now.)
-- The PPC code of a Universal Binary may be compiled (depending on
the kind of Apple's SDKs (Software Development Kits) used) for OSX
10.2.8, 10.3.9 or 10.4.x but not for earlier OSX-versions.
-- Xcode 2.2 comes with a utility called "lipo" (also a NEXTStep
heritage) that produces a Universal Binary app from several Mach-O
code versions. This means that -- whatever compiler you use that
results in Mach-O code for PPC and Intel -- you can produce Universal
Binaries. Presently, the only alternatives to ggc4 are the mentioned
Intel compilers, however Absoft is expected to soon present (at
least) another FORTRAN compiler.
-- Intel CPUs don't comprise the Altivec-Unit. Intel's vector
processing unit is called SSE2 and woks differently. By using Apple's
accelerated math framework, Xcode automatically produces the
appropriate vector-code when compiling for Intel and PPC.
-- Universal Binaries must be separately tested and debugged on PPC
_and_ Intel Macs, i.e. you need machines of both types!
-- Universal Binary apps don't work with PPC-only plugins (but see below).
(2) What happens with existing PPC-only applications on Intel Macs?
-- By dynamic emulation such code is interpreted to be understood by
Intel Macs. This mechanism is called "Rosetta" which is not a
separate environment, such as "Classic", and usually the user is not
aware if he uses a Universal Binary or a PPC-only application, except
for the reduce speed of code execution, which doesn't matter for text
editing and the like.
-- Rosetta is CFM/PEF and Mach-O compatible and supports Altivec code.
However, it does not handle Classic apps, i.e. there is no way of
running Classic apps on Intel Macs. (OSX 10.4.x still supports the
Classic environment on PPC Macs but ships without MacOS 9.2.x. It is
to be expected that this will change with OSX 10.5.x !)
-- It is possible to force (via get Info from the Finder) a Universal
Binary app to run its PPC-code (instead of its Intel code) and then
use Rosetta. This is necessary if PPC-only plugins are to be used
with a Universal Binary app.
(3) What does all this mean for FB and FB-coders.
-- If you are still distributing/selling Classic apps, convert them
to OSX-code. In FB-speak this is called "Carbonization". (Originally,
Carbon-code meant code that runs with MacOS 8.6-9.2.x _and_ OSX. FB
does not ensure that this holds true if you "Carbon"-compile your
FB-code, but it will produce nice OSX-only apps.)
-- If your apps are already OSX-apps, then, on Intel Macs, they will
be interpreted by Rosetta.
-- Presently, there is no way of generating Universal Binaries with FB.
-- When will we see an FB release that creates Universal Binary apps?
This requires at least two essential changes of the compiler. First,
it must compile PPC Mach-O, something that has long been overdue, and
second -- and probably more involved -- it must compile Intel Mach-O.
The integration may then be handled by calling "lipo".
That's it!
Let's hope that Andy is willing/able to (soon) rework the FB-compiler.
Thanks for reading!
Best
--
Herbie
------------------------
<http://www.gluender.de>