Call C++ Function in Python

Dave Kuhlman dkuhlman at rexx.com
Mon Aug 12 19:00:11 CEST 2002


Also look at SWIG (http://www.swig.org).

For some purposes, especially where you have a header file 
describing the functions you want to call, SWIG can often generate 
the wrappers for you automatically.

  - Dave

Martin v. Loewis wrote:

> arivu at qmaxtest.com (Arivazhagan) writes:
> 
>> We are planning to use python in our c++ Project. We have to
>> invoke a C++ function from Python. can any one help?
> 
> I recommend you read the "extending and embedding" tutorial:
> 
> http://www.python.org/doc/current/ext/ext.html
> http://www.python.org/doc/current/api/api.html
> 
> You'll have to write an extension module. Since you will need to
> compile that with the C++ compiler, please make sure to use extern
> "C" on the module init function.
> 
> Regards,
> Martin

-- 
Dave Kuhlman
dkuhlman at rexx.com
http://www.rexx.com/~dkuhlman




More information about the Python-list mailing list