read (string)double pointer value in python (swig)

View: New views
1 Messages — Rating Filter:   Alert me  

read (string)double pointer value in python (swig)

by Thorat, Rajashree :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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]));
i++;
}
return i;
}
%}

**********************************************************

Stud.c
======================================

#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)
{
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.

Thanks,
Rajashree.

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@... -- and destroy all copies of this message and any attachments without reading or disclosing their contents. Thank you.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user