Re: Compiling in Xcode 4 For OS X 10.4 and 10.5
Re: Compiling in Xcode 4 For OS X 10.4 and 10.5
- Subject: Re: Compiling in Xcode 4 For OS X 10.4 and 10.5
- From: Mark Wagner <email@hidden>
- Date: Wed, 18 May 2011 15:01:50 -0700
On Tue, May 17, 2011 at 18:31, Howard Rodstein <email@hidden> wrote:
> I apologize in advance for the lengthy introduction. I think you need it to understand the motivation for the questions at the end of this post.
>
> My company's program runs on OS X 10.4 or later.
>
> I support a package that allows our users to create C or C++ plug-ins for our main program. Hundreds of people use the package, most of them occasional programmers.
>
> I am trying to add Xcode 4 projects and documentation to the package. I would like to keep things simple for our users and, if possible, allow them to create plug-ins that work on the OS versions that our main program supports. (I'm not concerned about PowerPC.)
>
> I presume that, in the not-too-distant future, Xcode 4 will be the default (shipped on DVD with new machines and included in OS upgrades) and I would like to avoid requiring our users to install Xcode 3.2 if they already have Xcode 4.
>
> I am confused as to whether you can compile a plug-in using Xcode 4 that will reliably run on OS X 10.4 and 10.5, even assuming that you use no API routines added after 10.4.
>
To answer this, you need to understand the difference between an API and an ABI.
The API (application programming interface) is the high-level
description of the interface between an application and its
environment: library function names and parameters, data types, etc.
The ABI (application binary interface) is the low-level description of
the interface between an application and its environment: how a data
structure is laid out in memory, which registers/memory locations are
used for function parameters and returns, how function names are
converted into symbols, and so on.
The C ABI has been set in stone essentially forever. Every C compiler
that targets a given platform will use the same ABI, so Xcode 7, GCC
5, LLVM 4, and any other C compiler you care to try can produce
software compatible with MacOS 10.4, if it can produce Intel Mac
software at all.
The C++ ABI has historically been unstable, though that is (slowly)
changing. Different C++ compilers (and even different versions of the
same compiler) vary in things like the mechanics of throwing
exceptions, the layout of virtual function tables, how function names
are converted into symbols, and in other ways. In order for a C++
program to work on a given system, it either needs to (a) keep its
C++-isms self-contained (ie. look like a C program to the outside
world), or (b) use the same C++ ABI as its environment.
GCC 4.2 doesn't generate code that uses any of the C++ ABIs that 10.4
supports. I believe the differences between 4.0 and 4.2 are subtle,
so you might be able to create C++ programs with Xcode 4 that work
with MacOS 10.4, but in general, if you want to create MacOS 10.4
software with Xcode 4, you need to stick to C (and be careful with
your APIs).
--
Mark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden