Executing CPython Functions from C #

I am working on a project where I need to be able to run a python function that depends on SciPy / NumPy. Due to the fact that this is an addition to an already launched project, using IronPython will not be an option.

Additional Information:

  • Python.NET seemed good, but I was not able to get the return value from RunString () (it will return only NULL).
  • It is necessary to pass arguments and catch the return value (tuple).
  • The function is in the statistical package that was created by the support group for the team, so modification of this will also be impossible.

I am very glad what to do. Any hints in the right direction are appreciated. Thanks for any help you can give!

I understand that this can be rather vague, but I can’t give details about the project. If any clarification is needed, please let me know and I will do my best!

+3
source share
4 answers

I think you could write a DLL that uses the CPython API to expose a function and then call it in C #? It is possible to embed a Python interpreter; although I never did this personally, I think it would be helpful: http://docs.python.org/extending/embedding.html

+2
source

Windows? , , CPython ++/CLI, .Net-ish- #. , , .

, " DLL-", , python, Boost.Python, , - , ( Beostoth Boost, Boost.Python, ++/CLR, ) .

+1

IronPython, DLR, . , , , , - , .

+1

The ironclad project has begun , allowing the use of IronPython's CPython extensions, especially SciPy / NumPy. I don’t know how useful it is (and how actively it is still being developed)

0
source

All Articles