Skip to content
Browse files

remove initial 'calling external C functions' tutorial - it's broken …

…beyond repair
  • Loading branch information...
1 parent 5655b44 commit ac8538fb7990fd8f1fb173553b78ccd08e3b8917 Stefan Behnel committed
Showing with 0 additions and 53 deletions.
  1. +0 −52 src/tutorial/external.rst
  2. +0 −1 src/tutorial/index.rst
View
52 src/tutorial/external.rst
@@ -1,52 +0,0 @@
-Calling external C functions
-============================
-
-It is perfectly OK do ``from math import sin`` to use Python's
-``sin()`` function. However, calling C's own ``sin()`` function is
-substantially faster, especially in tight loops. It can be declared
-and used in Cython as follows::
-
- cdef extern from "math.h":
- double sin(double)
-
- cdef double f(double x):
- return sin(x*x)
-
-At this point there are no longer any Python wrapper objects around
-our values inside of the main for loop, and so we get an impressive
-speedup to 219 times the speed of Python.
-
-Note that the above code re-declares the function from ``math.h`` to
-make it available to Cython code. The C compiler will see the
-original declaration in ``math.h`` at compile time, but Cython
-does not parse "math.h" and requires a separate definition.
-
-When calling C functions, one must take care to link in the appropriate
-libraries. This can be platform-specific; the below example works on Linux
-and Mac OS X::
-
- from distutils.core import setup
- from distutils.extension import Extension
- from Cython.Distutils import build_ext
-
- ext_modules=[
- Extension("demo",
- ["demo.pyx"],
- libraries=["m"]) # Unix-like specific
- ]
-
- setup(
- name = "Demos",
- cmdclass = {"build_ext": build_ext},
- ext_modules = ext_modules
- )
-
-If one uses the Sage notebook to compile Cython code, one can use a special
-comment to tell Sage to link in libraries::
-
- #clib: m
-
-Just like the ``sin()`` function from the math library, it is possible
-to declare and call into any C library as long as the module that
-Cython generates is properly linked against the shared or static
-library.
View
1 src/tutorial/index.rst
@@ -4,7 +4,6 @@ Tutorials
.. toctree::
:maxdepth: 2
- external
clibraries
cdef_classes
pxd_files

0 comments on commit ac8538f

Please sign in to comment.
Something went wrong with that request. Please try again.