[Tutor] How do use c/c++ methods in Python?

terence zhu terence_zhu78 at hotmail.com
Tue Aug 30 03:33:36 CEST 2005


Sorry for puzzling you!
I want to know how to map the C struct to a Python type within the wrapper 
or other methods?


>From: "Alan G" <alan.gauld at freenet.co.uk>
>To: "terence zhu" <terence_zhu78 at hotmail.com>,<tutor at python.org>
>Subject: Re: [Tutor] How do use c/c++ methods in Python?
>Date: Mon, 29 Aug 2005 11:24:37 +0100
>
>>Subject: [Tutor] How do use c/c++ methods in Python?
>>
>
>>Function Test(Struct A *a,int b). I want to use this function in 
>>Python,What should be the firt parameter?
>
>I'm not sure what you are asking here.
>To use a C++ function/method from Python you will need to write a wrapper 
>around the C++ code, probably using SWIG or some similar
>tool.
>
>Is this what you are trying to do? And if so are you asking how to map the 
>C struct to a Python type within the wrapper?
>
>Or are you trying to call the function directly? That won't be possible, 
>although if its a Windows function the ctypes library may help, and may 
>provide guidance on how to translate the struct.
>
>Can you clarify what you are trying to achieve?
>
>Alan G

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



More information about the Tutor mailing list