Hello,
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
%header%{
#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;
}
%}
**********************************************************
Stud.c
======================================
#include<string.h>
#include<stdio.h>
#include "stud.h"
int parse1(char *s, char *p,char **t)
{
strcat(p,s);
*t=&p[0];
}
**********************************************************
Stud.h
===================================
int parse1(char *,char *,char **);
**************************************************
>>> from stud import *
>>> a='rajashree'
>>> c='thoratf'
>>> d=new_charp(1000)
>>> parse1(a,c,d)
2300188
>>> 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.