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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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.231.138 with SMTP id tg10mr3157718pbc.7.1331744321393; Wed, 14 Mar 2012 09:58:41 -0700 (PDT) Path: h9ni25795pbe.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Anh Vo Newsgroups: comp.lang.ada Subject: Re: Endian problems - what best way to solve it with least effort Date: Wed, 14 Mar 2012 08:54:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <15653932.495.1331740450330.JavaMail.geo-discussion-forums@vbyl20> References: <10483391.72.1331661651734.JavaMail.geo-discussion-forums@vbdj6> NNTP-Posting-Host: 149.32.224.35 Mime-Version: 1.0 X-Trace: posting.google.com 1331744321 3136 127.0.0.1 (14 Mar 2012 16:58:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 14 Mar 2012 16:58:41 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=149.32.224.35; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-03-14T08:54:10-07:00 List-Id: On Tuesday, March 13, 2012 11:35:34 AM UTC-7, Simon Wright wrote: > 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! Thank you all very much for your reply. Our team has decided to modify Java side due to less effort is involved. In addition, the Little Endian conversion utility is used. I will update the result once it is completely tested.