I want to create an assembly using IronPython can call it from C#. Here are two things I am not asking.
I'm not asking how to call C# from IronPython. The easiest documentation to find describes how to call C# from inside IronPython. (For example, the tutorial that ships with IronPython.) I want to do the opposite, call IronPython from C#.
I'm not asking how to embed the IronPython interpreter. I've found several useful references (e.g. here and here) on how to call the IronPython interpreter from C#. That's helpful, but I'm more interested in creating a compiled assembly from IronPython. That is, I'd like to make method calls into the IronPython assembly rather than passing source code strings to the interpreter.
Once I've created the assembly, what are some tips on calling into it? One blog post I found said:
... calling a Python assembly from C# is non-trivial. That python assembly contains dynamic types, which are not easily reflected into useful C# objects.
Do you know any sort of cheat sheet for passing basic data types between IronPython and C#?
Update: The scenario I am most interested in for now is passing two or three double
values into Python and getting one or two double
values back. If I could pass in a string and get a string back that would be terrific, but my first priority is just passing numbers back and forth.