Using the UDK

Symbols available on dynamic linking of shared objects

When porting code built using another development system to UnixWare, if the code uses dlopen(3C) to open a dynamic shared library, you may get the following error on compilation:

   dynamic linker: ./main: relocation error: symbol not found: symbol

The dynamic linker on UnixWare and dynamic linkers from some other versions of the UNIX(TM) system (notably Solaris(TM)) differ in the way in which global symbols are made available to shared objects.

The Solaris dynamic linker, for example, makes all global symbols defined in dynamically-linked executable programs available for export to shared objects.

The UnixWare dynamic linker exports only those symbols actually referenced by the shared objects you explicitly link to the executable, or any of their explicitly linked dependents. Therefore, if the executable uses dlopen on an object that expects to find some symbol in the executable, it may not have been exported. UnixWare uses this approach to reduce the size of executables built with shared libraries.

If you want more of the symbols defined in your executable to be exported, use the following cc(1) command line:

   cc -Wl,-Bexport ...

See ld(1) for an explanation of the forms of the -Bexport option.

Next topic: A guide to debug for dbx users
Previous topic: Packaging compatibility modules with your application

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004