By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,345 Members | 1,775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,345 IT Pros & Developers. It's quick & easy.

using python from c/c++

P: n/a
alexandr writes:
Is it possible to create a library from my python module that can be
used from c/c++ application?


Yes... the only question is how difficult it is.

The basic idea is that you create a library containing Python that
contains a hard-coded copy of your python script (or which reads it
from a file). The basics of doing this are described here:

http://docs.python.org/ext/ext.html

.... it's not too difficult, but it's certainly not automated.

Of course, there's not much gain over simply invoking the python
interpreter with the correct command line options... the "unix way"
(programs invoking other programs as command line utilities) is
very powerful.

What would be quite nice would be a sort of inverse to SWIG... a
tool to mechanically create C wrappers around a Python program. I
haven't heard of such a beast, but perhaps someone else will write
in to point one out.

-- Michael Chermside

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.