Extending and embedding Python

T

Tommy Nordgren

I want to write an application that embeds and extends (at least) the
Python and Perl interpreters. Now i want to find as much as possible
about the Python tools used for extending and embedding Python.
To be more specific: My app should:
1. Parse an input file.
2. Call a script in some scripting language, to generate an output file,
for example in C++.

For task 2 I need to call an embedded interpreter, and also provide call
backs from the scripting language to C++, in order to read global
information collected during parsing.

In order to correctly compile and link my Application, I need a OS
independent way to find compiler options and linker options necessary to
find header files and libraries. What methods should I use from
DistUtils for this purpose.


I also need to find some way to verify that linker options necessary for
embedding Perl is not incompatible with linking options for embedding
Python.

Stockholm July 11, 2005
Tommy Nordgren
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Tommy said:
In order to correctly compile and link my Application, I need a OS
independent way to find compiler options and linker options necessary to
find header files and libraries. What methods should I use from
DistUtils for this purpose.

I don't think distutils supports linking applications that embed
Python, yet. It might be possible to write a distutils command for
that purpose, but I'd advise against that.

Instead, you should integrate the Python embedding into the build
process you alread have (e.g. make, shell scripts, whatever). You
can simplify the process by having a Python script compute all
the necessary parameters. You find the configuration-specific
information in distutils.sysconfig.

HTH,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top