Bob is basically correct, but here's the root of the problem:

a function pointer is (as should be obvious from the phrase) a pointer.  so
by declaring "Boolean oldTrap(FieldPtr, EventPtr);" you have already made
oldTrap be a pointer.  so sticking that extra "*" in the declaration of
oldTrap is what's hosing you, because it turns "oldTrap" into a pointer to a
pointer to a function, which is not what you want.


-----Original Message-----
From: Bob Ebert <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Cc: Palm Developers Forum List <[EMAIL PROTECTED]>
Date: Tuesday, May 11, 1999 10:24 AM
Subject: Re: Basic Hackmaster Problem


>At 6:39 PM -0700 5/10/99, Mark Campillo wrote:
>>Boolean (*oldTrap)(FieldPtr, EventPtr);
>>  //handled = oldTrap(fld, event); <-- This seems to be the problem line
>
>Well, honestly the pointer-to-function declaration syntax has always
>confused me, which is why I prefer typedefs, but I think it's the source of
>your problem.  The variable oldTrap in this case is a pointer to a
>function, so you need to dereference it in order to call it.
>
>That is, your line should be:
> handled = (*oldTrap)(fld, event)
>
>It would probably be clearer if you did something like this:
>
> // create the type
> typedef Boolean FldHandleEventFunction(FieldPtr, EventPtr);
>
> // declare the variable -- explicitly a pointer to a function
> FldHandleEventFunction *oldTrapP;
>
> // get the value
> FtrGet(myCreator, myResID, &oldTrapP);
>
> // call the function
> handled = (*oldTrapP)(fld, event)
>
>
> --Bob
>
>
>

Reply via email to