08-20-04 07:51 AM
Hi All,
I've got a problem where I have two .so's that contain a function with
the same name and the loader picks just one to be used for resolving
all references. I'm sure it's a common problem, but I'm having
trouble explaining it, so a diagram:
+-------------------+
| program |
+-------------------+
| |
V V
+-------+ +-------+
| a1.so | | b1.so |
+-------+ +-------+
| |
V V
+-------+ +-------+
| a2.so | | b2.so |
+-------+ +-------+
a1.so and a2.so are two libraries of a particular component. b1.so
and b2.so are two libraries of a seperate independent component.
a1.so and b1.so don't contain any clashing symbols. a2.so and b2.so
each have a function with the same name, let's say foo(). When a1.so
was linked, the linker saw that it could resolve foo() against a2.so
and flagged it as such. When b1.so was linked, the linker saw that it
could resolve foo() against b2.so and flagged it as such. However,
when linking a1.so and b1.so into program with a line such as (forget
about the missing lib prefix):
ld -o program program.o -la1 -lb1
the resulting executable when loaded resolves foo() against a2.so for
both a1.so and b1.so.
On Windows I get the behaviour that I need which is that since b1.so
was shown that it could resolve foo() against b2.so it will only
resolve it against that library at runtime. I need this behaviour
since a2.so and b2.so are actually different versions of the same
library and the program must be able to simultaneouly use components
which may use differerent versions of this library.
Any help is appreciated.
Regards,
Steven
[ Post a follow-up to this message ]
|