This is about the emulator error that reads:

<application> just <access-type> memory location <location>, causing an
address error. An "address error" means that the application accessed a 2 or
4-byte value at an odd (i.e., not even) memory address.

What is causing this error, in my app, is a call to WinDrawBitmap, which
takes 3 parameters.  The first is a pointer to memory where the bitmap is
stored, and the last two are the x and y positions of where the bitmap is to
be drawn.  My app retrieves a palm bitmap's data from a database, and loads
it into local memory.  This is, basically, what my code that does this looks
like:

// allocate resSize bytes and have handle bmpMemH point to it
bmpMemH = MemHandleNew( resSize );
// lock this memory and point to it with char pointer bmpMemP
bmpMemP = MemHandleLock( bmpMemH );
// move bmp data, pointed to by ptrToBmpDataInDB into
// the memory pointed to by bmpMemP
MemMove( bmpMemP, pointerTo, resSize );
// make sure to unlock and free bmpMemH after you're done with it
...

So now the bitmap memory is in bmpMemP, which is a global pointer, and by
the time this is called:

WinDrawBitmap( bmpMemP, x, y );

bmpMemP's address is 0x0000013A.  This is even.  I even checked the bmpMemP
data and it looks like it's a valid palm bitmap, and the first 4 bytes of it
are definitely the width and height that it should be (2 bytes each).  Yet
when I call WinDrawBitmap, I get the Address Error.

Another important thing - this error only comes up when running palm os
versions 3.3 or before.

Has anyone ever gotten around the "address error" mentioned at the top of
this post simply by physically altering the address of the pointer, or
altering the adress of where the data is to be written?  Any insight at all,
even if it's not a solution, would be extremely appreciated.  I, for one, am
running out of ideas.  Thank you!

-Zack Shenkle



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to