stef
stef

Reputation: 797

Use Python code in C/C++

I'm working in an embedded Linux environment and I have some Python code which I would like to use. My Python code is just doing some math, not using any library other than Numpy and the common ones.

Is there any way to build up a library that I can call from C or C++ code?

Upvotes: 11

Views: 27487

Answers (1)

NPE
NPE

Reputation: 500367

Embedding the CPython interpreter into a C or C++ program is actually pretty straightforward.

The official documentation has some complete examples.

Also, check out SWIG and Boost.Python.

Upvotes: 15

Related Questions