> 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. */
Quote:};
/* 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)