1. Armin Rigo
  2. cpython-withatomic


cpython-withatomic / Demo / embed /

Filename Size Date modified Message
1.1 KB
822 B
1.6 KB
255 B
665 B
This directory show how to embed the Python interpreter in your own
application.  The file demo.c shows you all that is needed in your C

To build it, you may have to edit the Makefile:

1) set blddir to the directory where you built Python, if it isn't in
the source directory (../..)

2) change the variables that together define the list of libraries
(MODLIBS, LIBS, SYSLIBS) to link with, to match their definitions in

An additional test program, loop.c, is used to experiment with memory
leakage caused by repeated initialization and finalization of the
interpreter.  It can be build by saying "make loop" and tested with
"make looptest".  Command line usage is "./loop <python-command>",
e.g. "./loop 'print 2+2'" should spit out an endless number of lines
containing the number 4.