Python inside C++

Ken Seehart ken at
Tue Apr 14 12:47:19 CEST 2009

AJ Mayorga wrote:
> Hello all,
> I am looking for a way  to statically compile pythonxx.dll into my C++ 
> application, so that I can use It as an internal scripting language 
> and either run the native python code or take an ELF from 
> py2exe/pyinstaller and run that.
> The machines that will have my C++ app running on them do not have 
> python and I cannot install it as part of my application. Any Ideas?
> AJ
> ------------------------------------------------------------------------
> --
Sure, that's easy.

That should do what I think you want.

Picky note: The phrase "statically compile pythonxx.dll into my C++ 
application" is not quite correct.  A DLL is dynamically linked, not 
statically linked.  All this means is that you ship pythonxx.dll with 
your application along with any other DLLs and pyd files you might 
need.  But don't worry, you can do what you want.

Embedding = Using python inside an application that is written in 
another language (usually C/C++).  This is what you are asking about.
Extending = Making your C/C++ code callable from python.  (there are 
actually several alternatives available, but that is another topic).


More information about the Python-list mailing list