calling Pyrex results from C
John J. Lee
jjl at pobox.com
Tue Jan 20 19:01:01 CET 2004
Kyler Laird <Kyler at news.Lairds.org> writes:
> This means that I can't, for example, make a function that takes a
> filename (string), uses PIL to do a bunch of operations, and
> returns a string.
I don't see why you shouldn't be able to write a module in Pyrex, then
use standard embedding techniques to embed Python and then call your
module with a few C API calls. Or do the same, but also write a Pyrex
cdef function to wrap it all up, so you can just call that as a "plain
old" C function instead of those final few C API calls (you'll still
need other embedding calls, of course, to initialise Python, etc.).
Try the pyrex mailing list if you're stuck.
I'd very definitely check to make sure you aren't going to get marked
down for being a smartass, though (even if you're generating C that
doesn't depend on Python at all, it might still be unreadable).
> Any suggestions (besides "suck it up and do it all in C")?
I think I'd do it in C, regardless of whether or not it's allowable to
More information about the Python-list