Hi,
I am facing a problem with swig while using Pointers:

<Array.c>
#include<stdio.h>
void Array(int *ptr)
{
        int i;
        for (i = 0; i < 6; i++)
        {
                printf("Index: %d - %d\n",i, *(ptr + i));
        }
}
<Array.i>
%module Array
%{
extern void Array(int *ptr);
#include<stdio.h>
%}
extern void Array(int *ptr);

While running:

>>> import Array
>>> a=[1,3,2,4,5,6,7,9]
>>> Array.Array(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: argument number 1: a 'int *' is expected, 'list([1, 3, 2, 4, 5, 6, 7, 9])' is received

Do I need to make some changes in Interface file?
Also I need to return that array after sorting it. How do I return it and collect the same in python.

Thanks and Regards,

Cheers!


«·´`·.(*·.¸(`·.¸ ¸.·´)¸.·*).·´`·» 

     «.....[ Garry ].....»

«·´`·.(¸.·*(¸.·´ `·.¸)*·.¸).·´`·» 

Blogging at http://garrythegambler.blogspot.com/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to