[pypy-dev] Newb questions about ext module writing

Armin Rigo arigo at tunes.org
Sun Jul 23 09:18:38 CEST 2006


Hi Scott,

On Sat, Jul 22, 2006 at 07:39:27AM -0400, Scott Dial wrote:
> I am admittedly ignorant of rctypes capabilities, but I can appreciate
> the conversion in C code being awkward. Reading around more, I see in
> rctypes.implementation where an attempt for CALLBACK_FUNCTYPE was
> droppped. Seems like I have bitten off more than I can chew here.

Callbacks by themselves should "almost" work.  We need to re-enable the
commented-out code and try -- this code is lot complexity, some of it
bordering on the hackish side, which turned out not to be needed any
more at some point.  So to ease development of the rest of rctypes I
disabled the tests and commented it out.  But of course callbacks are
clearly needed in the long run.

Was I was complaining about is that there is no C-convertable way to
have e.g. bound methods as callbacks.  You can only use plain functions.
Many C libs have the same "design problem" as readline and don't pass
you a "void*" argument back.  An example of lib that is "correctly
designed" in this respect is the Windows API.

So for now I suppose these cases can be handled by just assuming that
there is only one 'space' around, and storing it in global state.


A bientot,

Armin.



More information about the Pypy-dev mailing list