[Pyrex] Question + 1new

Riccardo Trocca rtrocca at libero.it
Thu Apr 17 10:32:45 CEST 2003


Just a question:
doing so the RIMAGE_BGR24 is writable?
I know that you are already working hard on Pyrex, but would it be possible
to have an "ad hoc" way to export RO symbols from C?
Another question (but remember that I'm just learning Pyrex :-) ):
Now I can easily import a C function from an header file, but if I want to
expose that function directly to Python I need to create a wrapper
explictly. Am I right? Exporting a function to Python is a two steps
process?
Is it planned to add a "one step" approach in the future?
Anyway it should be easy to write some kind of preprocessor that
automatically creates all the code in Pyrex.
I'm just thinking about SWIG where that can be easily done (but it seems to
me that SWIG an Pyrex are very different tools in "spirit").

Riccardo


----- Original Message -----
From: "Greg Ewing" <greg at cosc.canterbury.ac.nz>
To: <pyrex at lists0.copyleft.no>
Sent: Thursday, April 17, 2003 1:35
Subject: Re: [Pyrex] Question


> Riccardo Trocca <rtrocca at libero.it>:
>
> > For example I've got #define RIMAGE_BGR24 0x8001.
> > I declared it in the import part of the pyx file because I need it =
> > inside the pyrex code.
> > Now what can I do in order to mymodule.RIMAGE_BGR24?
>
> If you assign it to a module-level variable, it will
> be accessible from Python.
>
> To get it to have the same name, you'll need to make
> use of a feature I added recently for renaming things:
>
>   cdef extern from "something.h":
>     cdef enum:
>       C_RIMAGE_BGR24 "RIMAGE_BGR24"
>
>   RIMAGE_BGR24 = C_RIMAGE_BGR24
>
> You've now got two different names defined in Pyrex:
> C_RIMAGE_BGR24, which is a C constant, and
> RIMAGE_BGR24 which is a module-level Python variable.
>
> Inside the Pyrex file, you should use C_RIMAGE_BGR24
> whenever you need it in a C context, since it'll be
> faster.
>
> Greg Ewing, Computer Science Dept,
+--------------------------------------+
> University of Canterbury,    | A citizen of NewZealandCorp, a   |
> Christchurch, New Zealand    | wholly-owned subsidiary of USA Inc.  |
> greg at cosc.canterbury.ac.nz    +--------------------------------------+
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex




More information about the Pyrex mailing list