|
From: Bob H. <bob...@gm...> - 2008-01-25 04:08:25
|
I can't finish this after all!!
Although it normally works fine, when I return a NULL pointer I get:
my_foo, ret = foo_create(10, my_data)
TypeError: 'int' object is not iterable
... so I tried to return (FOO *) 1 instead of NULL and that gets past that
point but goes on to give a Seg Viol later - presumably as it tries to free
it.
Any ideas?
Here are the .h and .i files again:
foo.h:
typedef struct {
int len;
unsigned char *data;
} FOO;
int foo_init(int len, unsigned char *data, FOO **foo);
int foo_fini(FOO *foo); /* free up the structure */
FOO *foo_generate();
void print_foo(FOO *foo);
foo.i:
%module foo
%include "typemaps.i"
%include "carrays.i"
%array_functions(unsigned char, data_array);
%{
#include "foo.h"
%}
FOO *foo_create(int len, unsigned char *data, int *OUTPUT);
%inline %{
FOO *foo_create(int len, unsigned char *data, int *ret) {
*ret = 1;
return(NULL);
}
%}
%include "foo.h"
|