Re: double pointer problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: double pointer problem

Marcelo Matus
Given that

int build(objid **pid)
 pid[0]->val = 10;
 pid[0]->wt =20;
 return 1;

is expecting an array ob aobjid, you need to provide
an array of pointer.

look at the carray.i and cpointer.i if you can get any solution
or ideas from them, and/or write a method that create the array
for you, ie, something like

objid **new_objid_parray(int n) {
   objid **res = (objid **)malloc(sizeof(objid*)*(n+1));
   for (int i =0; i < n; ++i) {
        res[i] = malloc(sizeof(objid));
   res[i] = 0;
   return res;

void delete_objid_parray(objid **parray) {
  for (...) ...

in in python use it as

t1 = mymod.new_obid_parray(1)

but again, take a look first at carray.i and cpointer.i for ready
to use solutions.


This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit for more information
Swig-user mailing list
[hidden email]