Kenwood HP 9000 Personal Computer User Manual


 
Chapter 5 179
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
The 32-bit mode linker does not remember the definition of a procedure
in a shared library unless it was referenced in previously scanned object
files.
If you have function names that are duplicated in a shared and archive
library, the 64-bit mode linker may reference a different version of a
procedure than is referenced by the 32-bit mode linker. This change can
lead to unexpected results.
For example, given these source files:
sharedlib.c
void afunc()
{
printf("\tin SHARED library procedure 'afunc'\n");
}
unsat.c
void bfunc()
{
afunc();
}
archive.c
void afunc()
{
printf ("\tin ARCHIVE library procedure 'afunc'\n");
}
main.c
main()
{
bfunc();
}
If these files are compiled and linked as:
cc -c main.c unsat.c archive.c
cc -c +z sharedlib.c
ld -b sharedlib.o -o libA.sl
ar rv libB.a archive.o
cc main.o libA.sl unsat.o libB.a -o test1
The 32-bit linker toolset produces:
$ test1
in ARCHIVE library procedure `afunc'