[Pyrex] How to use C functions in many Pyrex files?

Josiah Carlson jcarlson at uci.edu
Wed Apr 5 20:16:09 CEST 2006


Tomasz Primke <tprimke at interia.pl> wrote:
> 
> Let's assume, that I have a "C" function in a Pyrex file, that I want to use 
> in other Pyrex files.
> 
> --- p1.pyx file ---
> cdef void C_function( int i ):
>   print "i =", i
> 
> 
> What have I to do to access the C_function from another Pyrex file? I have 
> read the "Sharing Declarations Between Pyrex Modules" - but, as far as I 
> understand this document, the C_function is not a "C type declaration", nor 
> an "extern C function" (or variable), nor an "extension type" (its 
> definition part, to be precise). So can it be used in another Pyrex file or 
> not?

If you want to have the literal equivalent of a C include, you can use:

    include "p1.pyx"

Wherever you want to use that function.

 - Josiah




More information about the Pyrex mailing list