    return TCL_ERROR;
  }
  $1 = (char **) malloc((nitems+1)*sizeof(char *));
  for (i = 0; i &lt; nitems; i++) {
    $1[i] = Tcl_GetString(listobjv[i]);
  }
  $1[i] = 0;
}

// This gives SWIG some cleanup code that will get called after the function call
%typemap(freearg) char ** {
  free($1);
}

// Now a test functions
%inline %{
  int print_args(char **argv) {
    int i = 0;
    while (argv[i]) {
      printf("argv[%d] = %s\n", i, argv[i]);
      i++;
    }
    return i;
  }
%}
%include "tclsh.i"

</pre>