On 1/19/07, Jonathan Johnson <[EMAIL PROTECTED]> wrote:

On Jan 19, 2007, at 7:03 AM, James Sentman wrote:

> Hi Folks,
>
> I finally upgraded my RB IDE to begin building universal versions
> of things and I'm running into issues with memory blocks and endian
> problems.  Specifically for data that was stored in binary files
> and for binary network protocols between a PPC and an Intel Macintosh.
>
> I can get some things to work by simply setting the littleendian
> property of the memory blocks I use to build the packets to false
> on the Intel build. But that doesn't seem to solve all the
> problems. What other things are affected by endianness? String set
> via the stringvalue command in a memory block seem to be
> unaffected. Are there some things that aren't set properly by
> simply setting the littleendian property to false?

Because strings are treated as binary data, REALbasic does not know
how to swap strings when assigning them to memoryblocks. If you're
using UTF-16 strings, this could be a problem because the strings
need to know what endinanness they are, and may require manual swapping.

The items that need to be swapped are all the integer types. The
MemoryBlock will automatically swap these values for you, if you
properly set the LittleEndian flag. Any strings that need to be dealt
with are up to you to let REALbasic know what encoding they are.

HTH,
Jon


I too have run into this problem with my new UB builds (I use custom
plugins that write to memblocks complicating even further).

The obvious solution is to set m.LittleEndian = false to mimic
PPC-style endianness on all platforms.  Is this the "correct" way of
dealing with endianness?  Importantly, is there a performance hit when
running on Intel and having PPC-style bigendian memblocks
(byte-swapping)?

What about files (eg. memblocks dumped to a binary file) written to
disk from a PPC version of my app then read in on an Intel version?
what about a PPC version running under Rosetta on Intel?

Why the heck did Intel and Motorola/Apple/IBM not decide on the same
endianness 30 years ago for crying out loud?

This is becoming a nightmare.

Help!

P.


--
-------------------------------------------------------------------------------
Peter K. Stys, MD
Professor of Medicine(Neurology), Senior Scientist
Ottawa Health Research Institute, Div. of Neuroscience
Ottawa Hospital / University of Ottawa
Ontario, CANADA
tel:    (613)761-5444
fax:    (613)761-5330
http://www.ohri.ca/profiles/stys.asp
-------------------------------------------------------------------------------
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to