Thanks - I should have seen that it was doing a pass by value.
I do need to use the non-relocatable memory (MemPtr).
Ken
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/
I´d do it like this
void AAA(void)
{
MemHandle iBuffH;
UInt8* iBuffPtr=NULL;
UInt16 iLen;
iBuffH = MemHandleNew(1);
iLen = BBB(iBuffH);
iBuffPtr = MemHandleLock(iBuffH);
//do something with iBuffPtr
MemHandleUnlock(iBuffH);
MemHandleFree(iBuffH);
iBuffPtr is passed by value:
iLen = BBB(iBuffPtr);
Therefore, even if BBB changes the value of iBuffPtr, the caller (namely
AAA) will not see the change.
One fix would be to pass a pointer to iBuffPtr. The above call would look
like:
iLen = BBB(iBuffPtr);
and BBB would look like: