[Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.82,1.83

Fred L. Drake python-dev@python.org
Fri, 8 Sep 2000 15:54:56 -0700


Update of /cvsroot/python/python/dist/src/Doc/ext
In directory slayer.i.sourceforge.net:/tmp/cvs-serv30894/ext

Modified Files:
	ext.tex 
Log Message:

Add a brief section on linking Python as an embedded scripting language.

This closes SourceForge bug #110833.


Index: ext.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ext/ext.tex,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -r1.82 -r1.83
*** ext.tex	2000/08/11 17:09:23	1.82
--- ext.tex	2000/09/08 22:54:53	1.83
***************
*** 2112,2114 ****
--- 2112,2151 ----
  itself using \Cpp{}.
  
+ 
+ \section{Linking Requirements
+          \label{link-reqs}}
+ 
+ While the \program{configure} script shipped with the Python sources
+ will correctly build Python to export the symbols needed by
+ dynamically linked extensions, this is not automatically inherited by
+ applications which embed the Python library statically, at least on
+ \UNIX.  This is an issue when the application is linked to the static
+ runtime library (\file{libpython.a}) and needs to load dynamic
+ extensions (implemented as \file{.so} files).
+ 
+ The problem is that some entry points are defined by the Python
+ runtime solely for extension modules to use.  If the embedding
+ application does not use any of these entry points, some linkers will
+ not include those entries in the symbol table of the finished
+ executable.  Some additional options are needed to inform the linker
+ not to remove these symbols.
+ 
+ Determining the right options to use for any given platform can be
+ quite difficult, but fortunately the Python configuration already has
+ those values.  To retrieve them from an installed Python interpreter,
+ start an interactive interpreter and have a short session like this:
+ 
+ \begin{verbatim}
+ >>> import distutils.sysconfig
+ >>> distutils.sysconfig.LINKFORSHARED 
+ '-Xlinker -export-dynamic'
+ \end{verbatim}
+ \refstmodindex{distutils.sysconfig}
+ 
+ The contents of the string presented will be the options that should
+ be used.  If the string is empty, there's no need to add any
+ additional options.  The \constant{LINKFORSHARED} definition
+ corresponds to the variable of the same name in Python's top-level
+ \file{Makefile}.
+ 
  \end{document}