swig c binding

stash stashluk at codem.com
Tue Nov 25 14:00:34 EST 2003


I have the following struct in my c header file:

typedef struct _Foobar {
	double foo;
	double bar[3];
} Foobar;

I have wrapped it in swig and it appears to have worked...
In my python file now:

import foobar
x = foobar.Foobar()
x.foo = 3.14 			#works
x.bar = (1.2, 2.3, 3.4)		#returns an error

What have I gotten confused here?  I've tried some things with the
carrays.i, but didn't really get anywhere.  What is the proper syntax?
 I eventually want to turn x into a byte stream and send it over a
serial port.




More information about the Python-list mailing list