I would like to know hot to pass address reference to ‘c’ function through python. I am using swig for ‘c’ anf python interfacing

Interface file : stud.i
%module stud
#include "stud.h"
%include "stud.h"
%array_functions(char *,charp );
%inline %{
extern int parse1(char *,char *,char **);
%inline %{
int print_args(char **argv) {
int i = 0;
for(i=0;i<=180;i++) {
printf("argv[%d] = %c\n", i,*(argv[i]));
return i;



#include string.h
#include stdio.h
/*the angular braces are removed as here as they were causing issues in posting*/
#include "stud.h"
int parse1(char *s, char *p,char **t)
int parse1(char *,char *,char **);
>>> from stud import *
>>> a='rajashree'
>>> c='thoratf'
>>> d=new_charp(1000)
>>> parse1(a,c,d)
>>> d
Swig Object of type 'char **' at 0x28aca0

Now I want read value of d in python… How do I do it.

Any type of help is appreciated.


This email and any attachments may contain legally privileged and/or confidential information of Starent Networks, Corp. and is intended only for the individual or entity named in the message. The information transmitted may not be used to create or change any contractual obligations of Starent Networks, Corp. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this e-mail and its attachments by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify the sender immediately -- by replying to this message or by sending an email to postmaster@starentnetworks.com -- and destroy all copies of this message and any attachments without reading or disclosing their contents. Thank you.