Search code examples
c++cironpythonpython-c-api

How to embed IronPython in a non-.NET application?


Is it possible to call IronPython functions (and get access to their return values), from C/C++ code, without .NET? And if yes, how?

Is an embedding approach as in the python-c-api possible (i.e. as described here: http://docs.python.org/2/extending/embedding.html)?.

In our project, we cannot depend on .NET. However, we'd like to interact with other software, which exposes its interface through IronPython.


Solution

  • The only way to do it would be to host the .NET runtime or embed Mono in your C++ application, and then run IronPython inside of the embedded CLR. IronPython requires a CLR implementation; there's simply no way around that.