From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,c7a40d2c8112faaa X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-04-15 13:53:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!bad-news.newsread.com!netaxs.com!newsread.com!newsfeeds-atl2!e3500-atl1.usenetserver.com.POSTED!53ab2750!not-for-mail Sender: jlm@uxjlm.compgen.com Newsgroups: comp.unix.tru64 Subject: Re: How do I compile 32-bits source code in Tru64? References: From: Jesse Marlin Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. NNTP-Posting-Date: Mon, 15 Apr 2002 16:43:11 EDT Organization: BELLSOUTH.net Date: 15 Apr 2002 16:51:18 -0400 Xref: archiver1.google.com comp.unix.tru64:7293 "Jim Liu" writes: > Dear All, > > I have a 32-bits Linux program. I want to port to Tru64. > How do I compile 32-bits source code in Tru64? > I have compaq C/C++ complier and gcc complier in Tru64. > I know -xtaso_short -taso flag can change pointer from 64-bits > to 32-bits in compaq C/C++ complier. But my application's > RPC function still can't work. In addition, how to change > "long" type to 32-bits? I think the preferred way to handle this would be to make it work the same on either platform. If you need 64 bit or 32 bit values then define them in a central place and have them set accordingly per the architecture. It would definitely be easier to port using gcc because most of the compiler directives would be available in either architecture. For example #pragma pack(x), which allows you to set the default packing. This will be important when writing structures over a network or to disk where you want the structure to be the same size on each architecture. #pragma pack(1) struct rpc_struct { myint32 command; /* 4 bytes */ char flag; char filler[3]; /* This aligns us to an 8 byte boundary, which is important for DGUX, but not for linux. */ myint32 status; /* 4 bytes */ char filler[7]; /* Align to 8 byte boundary. */ myint64 last_status; /* 8 bytes. */ }; /* Restore to natural alignment */ #if arch == TRU64 #pragma pack(8) #else #pragma pack(4) #endif Some of the above is pseudo-code, but the idea is to make the code sharable between the architectures and platform dependent only when absolutely necessary. The typedefs make our structure the same size on either platform. This would be important if you were sending data from DGUX->Linux or vice-versa. Hope this helps. > > Thank you! > > Jim (J. J. Liu) > Email: jjliu@cs.nchu.edu.tw