At 4:50 AM -0400 1999/10/04, Kourosh Bodaghi - XPAND Corp 703.742.0900 wrote:
>I tried to run my application in POSE and I am getting a "just read
>directly from  an unlocked memory chunk" error when I try to add new
>records. I am attaching 2 functions and the record struct definition.
>I get the error when I try to access the CTABRecord *recordstruct in the
>function PackRecord. I can't understand what is causing this problem.
>I appreciate any help anyone can offer.

You're only allocating 48 bytes for the record here:

  recHandle = DmNewRecord(CTABDB, &index, sizeof(newRecord));

sizeof(newRecord) = sizeof(CTABRecord) = 12 pointers, not 12 strings of some maximum 
size.

You need to allocate a working buffer large enough to hold the maximum lengths of all 
your fields, pack the strings into it, shrink, then store. Obvious optimizations 
include a record length calculation preflight before the initial DmNewRecord to reduce 
use of the memory manager, etc.

Regards,

Jim Schram
3Com/Palm Computing
Partner Engineering

Reply via email to