[Gs-devel] Solaris dynamic linking

Russell Lang gsview at ghostgum.com.au
Mon Oct 1 02:05:08 PDT 2001


Question for Unix experts:  How do you make a shared library
call a function within the shared library, instead of a function
with the same name in the caller?

I have succeed in compiling Ghostscript as a shared object on 
Solaris.  Apart from the obligatory changes to the X11 include and 
lib files, it was necessary to replace "-soname" with "-h".
The Solaris linker uses -h to specify the internal name of the shared 
object, while the GNU linker uses -soname.

I then called Ghostscript from GSview on Solaris, and found that it 
would crash on tiger.ps.  Both GSview and Ghostscript contain
the dsc parser.  The crash was caused by Ghostscript using the dsc 
parser in GSview, not the one in the Ghostscript shared object.
The GSview version had a different structure, so when Ghostscript
tried to access members in the structure it read garbage and crashed.

The first kludge I have used is to move the new members in the 
structure to the end, not the middle.  This avoids the crash.

A better solution would be to make Ghostscript use its own dsc 
parser, not the one in GSview, hence the question above:
How do you make a shared library call a function within the shared 
library, instead of a function with the same name in the caller?



Russell Lang                   gsview at ghostgum.com.au
Ghostgum Software Pty Ltd      http://www.ghostgum.com.au/




More information about the gs-devel mailing list