Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Howto: Xcode project universal with ppc and x86 assembler sources

0 views
Skip to first unread message

abz

unread,
Nov 13, 2009, 7:15:14 AM11/13/09
to
How to make a "universal" project with objective C source and ppc and
x86 assembler sources.
Both (.s) assembler source has the same name for subroutine.
I can call assembler subroutine from C without problem using two
project: one for ppc and an other for x86.
I can also do a "universal" project but only with a single assembler
source (ppc or x86 both not both)
I wish merge the ppc and x86 as a "universal" project holding both ppc
and x86 assembler source.
As soon as I try to add a second assembler source to a "universal"
project Xcode complaint architecture mismatch...

Sherm Pendley

unread,
Nov 13, 2009, 9:34:04 AM11/13/09
to
abz <abi...@gmail.com> writes:

> How to make a "universal" project with objective C source and ppc and
> x86 assembler sources.

You can use preprocessor macros in assembler. So, in asmfunc_ppc.s you
could write:

#ifdef __ppc__
/*
PPC code goes here
*/

And, in asmfunc_x86.s:

#ifdef __i386__
/*
32-bit x86 code
*/

Now you can safely add both files to your project. If you're supporting
64-bit you can also check for __ppc64__ and/or __x86_64__.

Xcode will still assemble asmfunc_ppc.s when building for i386, and vice-
versa, but the #ifdefs make sure that only the correct code is visible
for the architecture currently being built.

sherm--

abz

unread,
Nov 13, 2009, 4:43:19 PM11/13/09
to

I will try it tonight.
Thank a lot.

0 new messages