Only the pointer to ud will be preserved when you call PceNativeCall not the data, so you will have to use ReadUnaligned32(&ud->in); to read the unaligned pointer to in which holds text. The ReadUnaligned32 is defined in endianutils.h in the Metroworks Codewarrior/CW for PalmOS support/ Armlet Support folder. All endianess related utilities are defined in this header.
And you need not reverse the endian of ud you can use it directly as userData * ud = (userData *) userData68KP; in armlet as the pointer data will be preserved from endian conversion.
Regarding dynamic memories, 68K code and Armlet have seperate dynamic memory area.
- Dollars 5
On 9/18/06, Zack Shenkle <
[EMAIL PROTECTED]> wrote:
I have a struct called "userData", with a char* member, called "in". I allocate some memory, put some text into it, create an instance of userData, and set userData->in equal to the new memory I've allocated. Effectively I've done this:
char *text = MemPtrNew( 20 );
userData *ud = new userData;
StrCopy( text, "bob" ); // put some text into it
ud->in = text;
Now I want to pass that ud as the userData parameter (second parameter), and call PceNativeCall (which calls the ARM code I've written that takes this userData). By this time I've successfully gotten the ARM code I've written as a resource, and I pass that in the first parameter to PceNativeCall.
Within the ARM code I reversed the endian of the "in" pointer (like you're supposed to) and I put some debugger outputs to check to see if "in" is still pointing to the text that says "bob". It isn't. The address of "in" in the ARM code is in fact the same address as the "in" in the 68k code, where I assign "bob" to it, but within the ARM code, the memory "in" points to just has NULL (0 values) in it.
Is it not possible, then, for ARM code and 68K code to look at the same dynamic memory? Must they have their own, separate dynamic memories? Any light anyone can shed on this problem I would greatly appreciate. Thanks!
-Zack
--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
-- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
