From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,40c39923d4ce99fe X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.135.231 with SMTP id pv7mr5665930pbb.8.1331663735533; Tue, 13 Mar 2012 11:35:35 -0700 (PDT) Path: h9ni22256pbe.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Endian problems - what best way to solve it with least effort Date: Tue, 13 Mar 2012 18:35:34 +0000 Organization: A noiseless patient Spider Message-ID: References: <10483391.72.1331661651734.JavaMail.geo-discussion-forums@vbdj6> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="15643"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+p5Bae1CkTrAZqTraWkt3XoKU2bI/hJbY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:pmxGu03+3QV3rVELEpQXHUQKNlo= sha1:ROJYSq806mQ2a1kB5qFZWbHZjI8= Content-Type: text/plain; charset=us-ascii Date: 2012-03-13T18:35:34+00:00 List-Id: Anh Vo writes: > I have an application previously running on Big Endian machine > communicating with a client simulator through socket. This client is > coded in Java running on a separate machine. The data exchanged > between them have different structures down to bits and bytes. > > Currently, this application is being ported to GNAT running on RH 5.4 > (Little Endian PC machine). As the result, both application and client > do not communicate correctly any longer due to endian mismatched. The > reason is that Java VM uses Big Endian format even though the client > runs on a PC. Was the previous version in Ada? I presume so or you'd have a translation effort with would already be non-minimal. What was the previous code like? A sample from a shortish message would help! If it just used Streams there might be a simple approach; in the Ada RTS adainclude/ there's a file s-stratt-xdr.adb (possibly s-strxdr.adb), which does stream formatting in network (b-e) order as you require. You should be able to put a copy of this file in your Ada source path as s-stratt.adb and recompile with the -a flag to gnatmake. I'm not sure whether gprbuild supports -a. Don't use the -f flag unless you want to rebuild the whole RTS!