Commit 58437f20 authored by Greg Ward's avatar Greg Ward

[from Oct 2000]

Clarify explanations of header file search directories.
parent 1f89e2ab
...@@ -505,23 +505,27 @@ Extension("foo", ["foo.c"], include_dirs=["/usr/include/X11"]) ...@@ -505,23 +505,27 @@ Extension("foo", ["foo.c"], include_dirs=["/usr/include/X11"])
\end{verbatim} \end{verbatim}
You should avoid this sort of non-portable usage if you plan to You should avoid this sort of non-portable usage if you plan to
distribute your code: it's probably better to write your code to include distribute your code: it's probably better to write C code like
(e.g.) \code{<X11/Xlib.h>}. \begin{verbatim}
#include <X11/Xlib.h>
\end{verbatim}
If you need to include header files from some other Python extension, If you need to include header files from some other Python extension,
you can take advantage of the fact that the Distutils installs you can take advantage of the fact that header files are installed in a
extension header files in a consistent way. For example, on a consistent way by the Distutils \command{install\_header} command. For
standard \UNIX{} installation the Numerical Python header files are example, the Numerical Python header files are installed (on a standard
installed to \file{/usr/local/include/python1.5/Numerical}. (The Unix installation) to \file{/usr/local/include/python1.5/Numerical}.
exact location will differ according to your platform and Python (The exact location will differ according to your platform and Python
installation.) Since the Python include installation.) Since the Python include
directory---\file{/usr/local/include/python1.5} in this case---is directory---\file{/usr/local/include/python1.5} in this case---is always
always included in the search path when building Python extensions, included in the search path when building Python extensions, the best
the best approach is to include (e.g.) approach is to write C code like
\code{<Numerical/arrayobject.h>}. If you insist on putting the \begin{verbatim}
\file{Numerical} include directory right into your header search path, #include <Numerical/arrayobject.h>
though, you can find that directory using the Distutils \end{verbatim}
\module{sysconfig} module: If you must put the \file{Numerical} include directory right into your
header search path, though, you can find that directory using the
Distutils \module{sysconfig} module:
\begin{verbatim} \begin{verbatim}
from distutils.sysconfig import get_python_inc from distutils.sysconfig import get_python_inc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment