[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] swig question
From: |
Brett L. Trotter |
Subject: |
Re: [Discuss-gnuradio] swig question |
Date: |
Thu, 24 May 2007 19:07:09 -0500 |
User-agent: |
Thunderbird 2.0.0.0 (Windows/20070326) |
Brett L. Trotter wrote:
> I've made a swig wrapper for some code that needs a char pointer passed
> in, how do I do such a thing?
>
>
>
Thinking about this more, maybe I need to give more information.
I've wrapped Phil Karn's FEC library and I'm trying to call encode_rs_char:
void encode_rs_char(void *rs,unsigned char *data, unsigned char *parity);
I passed it a string of a correct length, like I did for data, and it
only complained about the one for parity
my python looks like this
from fec import *
def main():
# make a test string with a predictable value
teststr = ''
for i in range(127):
teststr = teststr + chr(i)
# make a 127 byte long string to fill with parity
paritystr = chr(0) * 127
# create a handle for the reed-solomon function with the right
params
rs_handle = init_rs_char(8, 0x187, 1, 1, 128, 0)
# do the actual encoding
encode_rs_char(rs_handle, teststr, paritystr)
main()
and I get:
Traceback (most recent call last):
File "./test.py", line 18, in ?
main()
File "./test.py", line 15, in main
encode_rs_char(rs_handle, teststr, paritystr)
TypeError: in method 'encode_rs_char', argument 2 of type 'unsigned char *'
so what can I pass it?