C API for modules
Edward C. Jones
edcjones at erols.com
Tue Mar 26 23:25:01 EST 2002
John Machin wrote:
> "Edward C. Jones" <edcjones at erols.com> wrote in message news:<3CA09F43.80206 at erols.com>...
>
>>Is there some simple way to call functions in modules from C? In
>>particular, for module struct, how do I call pack, unpack, and calcsize?
>>
>
>
> OK, I'll be the bunny and ask the obvious(?) meta-question:
>
> Give that the struct module is designed for Python callers to
> pack/unpack C structs (laboriously), why bother? Why not just
> manipulate the structs in C??
So I should use PyString_FromStringAndSize in C and struct.unpack in
Python or struct.pack in Python and PyString_AsStringAndSize in C.
More information about the Python-list
mailing list