Hi..
I have created a shared object by developing and compiling it on RHEL 5.
Than I tried to use same shared object on RHEL 4 and SuSe 10.0.But it didn t work.Error message shown was " Floating point exception". Machine architecture was same for all the three distos.
So I want to know is it possible to compile a code in such a way that if it is compiled on RHEL 5 machine, same compiled code should work on any other Linux distros? If yes than how?

Thanx in Advance...

it should work on all distros. Most likely due to bad programming.

it should work on all distros. Most likely due to bad programming.

Its a sample code downloaded from Intel site. Which I have compiled to shared object.

Tell me which language the code is written in, and I'll move it to the appropriate forum. Lounges aren't meant for support questions, and you'll receive better help if it's in the Software Development forums.

Tell me which language the code is written in, and I'll move it to the appropriate forum. Lounges aren't meant for support questions, and you'll receive better help if it's in the Software Development forums.

Its written in C++.

Moved.

so why not telling us how to get that example code from INTEL side?

> So I want to know is it possible to compile a code in such a way that if it is compiled
> on RHEL 5 machine, same compiled code should work on any other Linux distros?
the problem is caused by changes in the ELF binary format between RHEL4/FC5 and RHEL5/FC6 or later. (the hash section and the hash format for symbol resolution has changed).
while RHEL5/FC6 and newer can handle both types of hash format, only the classical 'sysv' format is supported by older versions.
to make elf binaries which are backward compatible, use the linker switch --hash-style=sysv for example while compiling with g++, use -Wl,--hash-style=sysv

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.