How to generating both of 32 and 64 bit libraries?

Hi all,

I'm rebuilding an open source in Solaris 10 ENV using Studio 11 on an ultrasparc server. I want to build it with 32 and 64 bit libs (e.g /source/lib for 32 bit and /source/lib/sparcv9 for 64 bit). Could anyone tell me what are link options or compiler args can do these. (just compile once)

Thanks in advance.

[337 byte] By [white_facea] at [2007-11-26 17:11:06]
# 1
Unless your open source library specifically supports building both 32 and 64bit version at once (and most of them dont) you will have to configure/compile/install twice - once for 32bit and once more for 64bit.regards,__Fedor.
SFVa at 2007-7-8 23:38:55 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

You can't build one library or application for both 32-bit and 64-bit use. At minimum, you must compile and link everything once for each mode.

Using Studio 11 on Solaris, the default is to compile for 32-bit mode. To build in 64-bit mode, add the option -xarch=generic64 (unless you are already using -xarch=v9) to every command line, compiling and linking.

Use separate directories for 32-bit and 64-bit object code.

But as Fedor points out, code is unlikely to work when built in 64-bit mode unless it was designed and tested to work in 64-bit mode. Code that was developed in 32-bit mode usually has many hidden assumptions that fail in 64-bit mode.

Studio 11 provides various tools to help you port 32-bit code to 64-bit code, but you must realize it is a porting job. It is not difficult to write code that is correct for both 32-bit and 64-bit modes, but you have plan for it.

clamage45a at 2007-7-8 23:38:55 > top of Java-index,Development Tools,Solaris and Linux Development Tools...