Call C++ Function in Python

Martin v. Loewis martin at v.loewis.de
Mon Aug 12 12:00:29 EDT 2002


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




More information about the Python-list mailing list