bill@utastro.UUCP (William H. Jefferys) (10/06/88)
We have an application that we would like to set up so that the 68881 will be used if it is available, but that will still run on a Mac+/SE if it is not available. We are using THINK C v. 3.0x. This seems to boil down to two tasks. First, how do we tell that the 68881/68020 combination is installed? Second, having done this, how do we arrange to execute one version of the program if they are there, and another version if they are not? Obviously, we don't want to have both versions loaded at the same time as that would waste space; I assume that the answer is to have the main program call one of two different code resources. (The discussion on calling code resources is presumably relevant). If this is the case, (or if it is not the case), how do we set things up, using THINK C, to accomplish our end? Thanks for any assistance from the net. Bill Jefferys University of Texas Astronomy Dept. -- Glend. I can call spirits from the vasty deep. Hot. Why, so can I, or so can any man; But will they come when you do call for them? -- Henry IV Pt. I, III, i, 53
earleh@eleazar.dartmouth.edu (Earle R. Horton) (10/07/88)
In article <3226@utastro.UUCP> bill@utastro.UUCP (William H. Jefferys) writes: >We have an application that we would like to set up so that >the 68881 will be used if it is available, but that will still >run on a Mac+/SE if it is not available. > >We are using THINK C v. 3.0x. > >This seems to boil down to two tasks. First, how do we tell >that the 68881/68020 combination is installed? > The easiest way is to call SysEnvirons(), which will give you processor type, presence of Color QuickDraw, location of system folder, and lots of other useful info. >Second, having done this, how do we arrange to execute one >version of the program if they are there, and another version >if they are not? Obviously, we don't want to have both versions >loaded at the same time as that would waste space; I assume that >the answer is to have the main program call one of two different >code resources. (The discussion on calling code resources is >presumably relevant). > Assume for the moment that you write code to work with either SANE or the mc68881, whichever is available. You keep your SANE-using routines in one CODE segment, and your mc68881-using routines in another CODE segment. You don't call any routines in the unused segment, and it never gets loaded into memory. Neat, huh? You won't need custom code resources. (Consult your Think C manual for how to create a segmented program.) There are subtle problems inherent in this approach. For example, a SANE extended is 10 bytes wide, and an mc68881 extended is 12 bytes wide. Think C probably uses extended for double, which therefore makes it the basic computational data type in your program. In order to make this work properly, you will need extensive support and detailed instructions from your compiler manufacturer on how to compile a program, part of which uses SANE and part of which uses the mc68881. I wouldn't even attempt it unless I was being paid hourly for the work. If you are paying someone else to do this, think about that last sentence. I suggest two versions of the program, one for SANE and one for the coprocessor. Earle R. Horton. 23 Fletcher Circle, Hanover, NH 03755 (603) 643-4109 Sorry, no fancy stuff, since this program limits my .signature to three