How to transfer data structure or class from Python to C/C++?

Aaron "Castironpi" Brady castironpi at gmail.com
Fri Oct 17 13:47:42 EDT 2008


On Oct 16, 9:10 am, Hongtian <hongtian.i... at gmail.com> wrote:
> Not exactly.
>
> In my C/C++ application, I have following function or flow:
>
> void func1(....)
> {
>     call PyFunc(struct Tdemo, struct &Tdemo1);
>
> }
>
> I mean I want to invoke Python function 'PyFunc' and transfer a data
> structure 'Tdemo' to this function. After some process in Python, I
> want it return 'Tdemo1' back to the C/C++ application.
>
> I research boost.python and think it is not a reasonable solution
> because it make the C/C++ application too complex.
>
> Thanks.
>
> On Oct 16, 12:09 pm, "Aaron \"Castironpi\" Brady"
>
> <castiro... at gmail.com> wrote:
> > On Oct 15, 8:08 pm, Hongtian <hongtian.i... at gmail.com> wrote:
>
> > > Hi friends,
>
> > > I am a newer of Python. I want to ask below question:
>
> > > I have a C/C++ application and I want to use Python as its extension.
> > > To do that, I have to transfer some data structure from C/C++
> > > application to Python and get some data structure from Python to C/C++
> > > application. I have researched Python document, but the example only
> > > describes how to transfer some simple data, such as integer,char,
> > > etc.
>
> > > Could you please guide me to do that? or tell me some document to have
> > > a research?
>
> > > Thanks.

Did you have any luck?



More information about the Python-list mailing list