[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: Chris Stasny <staz@...>
Date: Sun, 19 Dec 1999 14:31:07 -0600
>I want to pass a record defined like this:
>dim myDesc as AEDesc
>
>to a function that's called like this:
>OSErr% = fn AFunction(@myDesc)
>
>and defined like this:
>local fn AFunction(replyDesc as ptr to AEDesc)
>
>and in that function I want to retrieve the reply to an appleevent I 
>sent to another app, with this toolbox call:
>OSErr% = fn AEGetparamdesc(@reply,_keyDirectObject,_kValObj,@replyDesc)
>
>so that when the function returns, the reply is in myDesc.
>
>Problem: The PPC compiler tells me:
>Error: Can't use a register variable here! Use DIM @
>*OSErr% = fn AEGetparamdesc(@AEReply,_keyDirectObject,_typeObj,*@replyDesc)
>
>I tried dimming a tempDesc as AEDesc record within the function, 
>using it in the AEGetParamDesc call instead of replyDesc, and then 
>using FN AEDuplicateDesc(@tempDesc,@replyDesc) to transfer the reply 
>into replyDesc, but it gives the same compiler error.
>
>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&



Best,

-STAZ  ~)~

800.348.2623 Orders  http://www.stazsoftware.com
228.255.7086 FAX     mailto:staz@...