Binary incompaitibility compiled of different versions
Manjunath H Bhajantri
manjunathbhajantri@yahoo.com
Sat Apr 20 06:17:00 GMT 2002
Hello,
I created a shared library, libhello.so, out of
program Hello.c which is having only one function
with the help of below commands, with the compiler
*gcc-2.96* on red hat linux-7.2
1. gcc -fPIC -c Hello.c
2. gcc -shared -Wl,-soname,libhello.so.1 \
-o libhello.so.1.0 Hello.o
3. ln -s libhello.so.1.o libhello.so.1
4. ln -s libhello.so.1 libhello.so
5. ldconfig
--------Hello.c----------------
#include <stdio.h>
void sayHello() {
printf("Hello! How are you?\n");
}
--------Hello.c----------------
Now when I try to use this library hello in my another
program but with different compiler - gcc-3.0.2,
linker says undefined reference to sayHello function.
libhello.so is in /usr/lib
and I tried to compile my program with the option
-lhello.
I was just wondering if this behaviour is expected
because I always thought that .so files are
independant
of compilers version on linux.
Thanks,
Manjunath.
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
More information about the Gcc-help
mailing list