[Tutor] Embedding C
BELSEY, Dylan
dylan.belsey@baesystems.com
Fri, 23 Aug 2002 09:09:15 +0930
Hi,
I have been dabbling a bit in this field trying to embed the python
interpreter in C++ and then calling back into C++ functions from the python
interpreter (commonly called extending).
You may want to look up SWIG (on Google), a very handy tool for
building interfaces between the two languages (it was purpose built
initially for C and now accommodates quite a bit of C++). There is quite a
bit of info about (again recommend searching google) and in the python docs.
I found this link very useful after I understood some of the concepts. It
initially talks about embedding but then goes on to describe building
extension modules:
http://www.faqts.com/knowledge_base/view.phtml/aid/5325/fid/245
The book "Professional Linux Programming - Neil Matthew and Richard
Stones et al.", Chapter 17 is also a source I used, although it can get
heavy going (for me that is), as you read further.
HTH
Dylan
-----Original Message-----
From: lonetwin [mailto:lonetwin@yahoo.com]
Sent: Thursday, 22 August 2002 18:45
To: tutor@python.org
Subject: [Tutor] Embedding C
Greeting all ye gentle Pythoneers,
Almost a year after I first touched Python, I fell am now ready to
dabble in experiments with emmbedding C in Python (I assume that is how one
describes the task of using/calling C functions through Python).
However, before I do this, I thought I'd drop by and ask a few
questions.
You see although I do (or did -- waaay back) know how to program in C, I am
a
bit apprehensive to start with the official Python Documentation on the
topic
(although I intend to do it eventually).
I would really appreciate it if someone could either point me to a
resource
to or give me a small example of calling C functions through Python. like
for
example passing "Hello World !" to a print_this() function from a hello.c
file.
....I guess Usless Python too could make use of such small examples.
Peace
Steve
--
What does education often do? It makes a straight cut ditch of a
free meandering brook.
-- Henry David Thoreau
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor