[futurebasic] [FB] Re: [FB^3] passing records & filling them via toolbox calls

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1999 : Group Archive : Group : All Groups

From: "Dr. Steven J. Stratford" <sstratford@...>
Date: Mon, 20 Dec 1999 21:15:53 -0600
>>What should I put in the AEGetParamdesc fn in place of @replyDesc 
>>so the descriptor gets passed back to the calling routine?
>>
>>--Steve
>
>
>Incoming parameters are always placed in registers. If you need to 
>use a variable that can't be in a register, you'll have to swap it 
>out in the local fn.
>
>>
>local fn AFunction(replyDescIN&)
>   DIM replyDesc as ptr to AEDesc
>   replyDesc = replyDescIN&

OK I'm with you.

Now, suppose I also had  "DIM anotherDesc as AEDesc" in the same function.

This call works:
OSErr% = FN AEGetParamDesc(......, @anotherDesc)

This call doesn't:
OSErr% = FN AEGetParamDesc(......, @replyDesc)
(that is, the descriptor is not placed in the correct place, which is 
the address equal to replyDescIN&).
Neither does:
OSErr% = FN AEGetParamDesc(......, replyDesc)

Something's different about passing the parameter when it's DIMmed 
"AS AEDesc" and DIMmed as "AS PTR TO AEDesc".

What's the difference?

If FN AEGetParamDesc is redefined with LONG instead of @LONG, then this works:
OSErr% = FN AEGetParamDesc(......, replyDescIN&) (that is, the 
descriptor is placed at the correct address).

Something here doesn't meet the eye.

--Steve