swig c binding

S

stash

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top