At 7:59 AM -0400 2002/05/25, Paul Nevai wrote: >Suppose you have a pointer voidP to somewhere in a record and you want to >change *voidP. DmWrite() and DmSet() will not work unless voidP points to >the beginning of the record and you do not know where the beginning is. > >Then I use > >MemSemaphoreReserve (true); >... >MemSemaphoreRelease (true); > >Is there any other way to do the job which avoids explicit use of these?
Sure... just track the start-of-chunk pointer too and dynamically calculate the offset from it to your voidP for the DmWrite operation. There's no way to do this with just one pointer however. Using MemSemaphoreReserve/Release defeats the purpose of having DmWrite validate the parameters before writing... you have to "prove" to DmWrite that you know what you're doing, writing only within the bounds of that particular chunk. The Memory Manager can't compute a chunk pointer given any random location in memory. That would be a nice feature, but... don't hold your breath for it. :o( Regards, Jim Schram PalmSource Inc. Partner Engineering -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
