[Pyrex] Python/C API or void * problems...

Scott Robinson scott at tranzoa.com
Sat Nov 1 18:38:42 CET 2003


Thanks!

Heh, I actually ended up doing the significantly more complex PyString
method. However, it had some advantages later in the integration.

It's good to know that the len() returns the proper value, though.

Scott.

* Andreas Kostyrka translated into ASCII [Sat, Nov 01, 2003 at 06:32:47PM +0100][<20031101173247.GA31836 at mtg.co.at>]
> On Fri, Oct 31, 2003 at 10:41:08PM -0800, Scott Robinson wrote:
> > I have a function I'm interfacing similar to the following:
> > 
> > int process_data (void *data, int data_length)
> > 
> > How would I pass a Python string to that? I'm trying something like:
> cdef extern from "myapp.h":
>    int process_data(char *data, int data_len)
>    # notice char *
> 
> ...
> process_data(pystr, len(pystr))
> 
> Andreas

-- 
http://quadhome.com/            - Personal webpage
http://tranzoa.net/             - Corporate webpage

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GAT dpu s: a--- C++ UL+++ P++ L+++ E- W++ N++ o+ K++ w++ 
O M V(-) PS+ PE Y+ PGP+++ t@ 5 X- R- tv(-) b++++ DI++++ D+ 
G e* h! r* y 
------END GEEK CODE BLOCK------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20031101/d71a0566/attachment.bin


More information about the Pyrex mailing list