I have the following function defined in my .i file

%inline %{
        void getNodes(char **nodes, int len) {
                int i;
                printf("pointer %p\n", nodes);
                for(i=0; i<len; i++){
                        printf("node = %s\n", nodes[i]);
                }
        }
%}

From python

>>> print data.getJobInfo()[2145]['exHosts']
<Swig Object of type 'char **' at 0x13990650>

>>> print  data.getJobInfo()[2145]['numExHosts']
37

>>> getNodes(data.getJobInfo()[2145]['exHosts'], data.getJobInfo()[2145]['numExHosts'])
pointer 0x13a1e7c0
node =

node = /
node = /
node = /
node = /
node = /
node = /
node = /
node =
Segmentation fault


In python the swig object is at "0x13990650" but when it is passed to the function it is "0x13a1e7c0". Is this correct? Shouldn't these address be the same?

Am i missing something....

Thanks,
Mahmoud


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.