Page 1 of 1

Problems with Extern Array of Pointers

PostPosted: Tue Sep 07, 2010 12:59 am
by daenerys
Hello,
it seems that there are some problems with array of pointers with external memory variables. There are no problems with the same array of pointers with internal memory/variables. The following snippet gives an example:
Code: Select all
struct PointerArray {
BYTE* ptrByte [4];
}
PointerArray InternMem;
extern PointerArray ExternMem = { "", 0x400000 };
BYTE Octet=123;
InternMem.ptrByte[1]=&Octet;
PrintF ("Intern: %d (equals to 123)", *InternMem.ptrByte [1]);
Octet=*ExternMem.ptrByte[1]; //should read byte at [0x00400004], but gives error "Code emition failed!"
PrintF ("Extern: %d", Octet);


Cheers,
danny

Re: Problems with Extern Array of Pointers

PostPosted: Tue Sep 07, 2010 5:06 am
by L. Spiro
You will have to perform the dereferences locally. That means copy the array to a local and initialize a new extern pointer with the address of the dereferenced array index-of-choice.


L. Spiro