From: Joseph C. <jos...@ni...> - 2010-01-07 22:47:34
|
Hi, How do you write an interface file to return an pointer to a pointer of array of ints (to python)? I have a C function with a prototype: int read_fileheader(FILE * fd, int * N, int * set, int ** dummy); That I have to deal with. The following swig interface file allows me to compile and run the code, but the values in the dummy array that are returned to python are garbage. %module rh3 %{ extern FILE * open_fileread(const char *); extern int read_fileheader(FILE * fd, int * N, int * set, int ** dummy); extern void close_fileread(FILE * fd); %} %include "typemaps.i" %apply int *OUTPUT { int * N } %apply int *OUTPUT { int * set } %apply int *OUTPUT { int ** dummy} extern FILE * open_fileread(const char *); extern int read_fileheader(FILE * fd, int * N, int * set, int ** dummy); extern void close_fileread(FILE * fd); What is the accepted way to take care of this? I have tried using typemaps(argout) but so far I have had no luck. I am new to swig, I have read the swig-python manual, I have tried reverse mapping the char **argv example to int **dummy but this is not working for me (yet). Any help is appreciated. Cheers, J |