[futurebasic] Re: re: Re: [FB] FAT Apps Question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2000 : Group Archive : Group : All Groups

From: AlStaff@...
Date: Tue, 4 Apr 2000 08:52:13 EDT
>>   in the FAT app it has both the 68k and PPC 
>>   (and chooses which to run based on the CPU
>
>so, could you swap out the data fork
>and swap in a completely different program?
>
>so a ppc machine would run program "x",
>and a 68k one would run program "y"?


FB3 PPC apps actually use the resource fork to store your code rather than 
the data fork. FB3 creates a small amount of code in the data fork so the Mac 
knos it's a PPC app. That code basically points to the actual code for your 
specific program which is held in Arry, FBop, and FCOD resources. Resources 
#1000 are for 68k programs and 1001 are for PPC programs. In other words, a 
FAT app has Arry resouces 1000 and 1001, FBop resouces 1000 and 1001, and 
FCOD resouces 1000 and 1001.

It is possible to swap out all of one set of resources and replace them with 
another set to make it run as one program in 68K and another in PPC. However, 
you would have to be very careful to make both programs use different STR# 
resources for the text string. You also have to use different ALRT, DLOG or 
other resources in each program except for any that would be the same in both 
programs.

It does work at least on a small basis as I just tried it. It's an 
interesting trick, although there isn't much real use for it. You could write 
one program with lots of
COMPILE LONG IF cpu68k
 ' do 68k stuff
COMPILE XELSE
 ' do PPC stuff
COMPILE END IF
to accomplish the same thing


Al Staffieri Jr.

AlStaff@...
http://members.aol.com/AlStaff/index.html