Porting... Solaris to AIX for C/C++ Applications

Wats need to change to port successfully? .
Its just to recompile every function in our application.

Thats it !!

If we are aware that our applications are going to port,then its better to do code our applications to adhere C/C++ ASCII standards.At least our efforts will be minimized in porting.

C++ Headers inclusion:
standard (std) C++ headers ,like with out .h shld be included following AIX rules.But in in solaris we can mix both .h and without .h header files. Solaris allows this way of mixing.

One shld note that include in "using namespace std; statement before function implementation in AIX.

Like char to int or char const to non-const pointers can be allowed in solaris without much type cast.But strictly these type exceptions are not allowed in AIX.

Compiling with 32-bit /64 bit options:
If we wont specify ,the compiler creates 32-bit object code on AIX and Solaris. If the application is compiled with the -xarch=v9 (V9a,V9b are available)flag on Solaris, then the code is written for a 64-bit environment and compiled in 64-bit mode. The option to enable compiling an application in 64-bit mode on AIX is –q64.

Linking and archiving :

In solaris we have option to archive objects using 'ar -xar' and in AIX ,similar kind of things can do as calling ' ar -X64 rv ' option.

in AIX:
for 32-bit applications
cc -c -o X.cc
ar -X32 rv libY.a X.o

for 64 bit applications
cc -c -o -q64 X.c
ar -X64 rv libY.a X.o

The archive, libY.a, contains both files. The loader determines whether a 32- or 64-bit application is being built and chooses the proper file.

Any third party library being linked into a 64-bit application must also be
64-bit. To determine the object mode of any 32-bit module or library on AIX, run
the command:
dump –X32 –ov
where file_name is the name of any object module, such as libxyz.a. In
the output, search for the string XCOFF. For 64-bit modules, use:

dump –X64 –ov

Limits &Advantages: (AIX) All objects and executables compiled and loaded with -q32 are limited to a maximum of 2 GB data and heap space. In contrast, objects and executables compiled and loaded with -q64 have no such practical software limits.