-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
just wanted to add that I somehow solved the problem, although I do not have the slightest idea why - please see below. Any explanation on why it now works would help me much to understand the gcc dynamic linking principles.
The problem occured with the following line, which worked perfectly well on my Debian unstable installation (using gcc 3.3.x):
[..] gcc -shared -Wl,-Bsymbolic,z,defs -L/usr/lib -L/usr/lib/wine/wine -lm -lc -lwine -lstdc++ -lgcc_s <all object files> -o lib<mydll>.dll.so
On RedHat 9, however, this failed with the following linker error:
/usr/bin/ld: lib<mydll>.dll.so: undefined versioned symbol name fprintf@@GLIBC_2.0 /usr/bin/ld: failed to set dynamic section sizes: Bad value collect2: ld returned 1 exit status
The first step to resolve this conflict was to omit the linking against standard GNU Linux system libraries, which seems to be done automagically:
gcc -shared -Wl,-Bsymbolic,z,defs -L/usr/lib/wine/wine -lwine -lstdc++ <all object files> -o lib<mydll>.dll.so
This removed versioned dependencies to glibc 2.0, but resulted in similar errors linking against stdc++ (it had undefined versioned symbol names @@GLIBSTDC++_3.2.1).
Omitting -lstdc++ was not possible, causing (as expected) unresolved symbols. The final way to successful linking, however, was switching to g++ to call the linker:
g++ -shared -Wl,-Bsymbolic,z,defs -L/usr/lib/wine/wine -lwine <all object files> -o lib<mydll>.dll.so
Any explanations, wild guesses or whatever to make me understand what may have caused the problem is still appreciated...
Cheers, Martin