-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export of Python function to a .NET assembly file #503
Comments
Hey Unfortunately no, this isn't possible using Pyjion. But you can do it using this other project |
It seems that PythonNet is actually embedding CPython, right? I was wondering whether the CIL / Pyjion-generated assemblies can be used from .NET as well (as it seems a cleaner solution if the original Python code is sufficiently simple) Is it not possible because the interfacing with the generated assemblies is hard / needs extra runtime? Because it seemed that if you generate assemblies anyway, some marshalling and function calling these assemblies from C#/.NET should be possible, no? |
Should we just be able to dump or maybe first create MethodInfo and then create an assembly just with one method? a question: will pyjion jit methods called from the currently-jitted method? (including the python standard library) An example of creating a minimal assembly from a MethodInfo seems here in the JitPacker/Unpacker: project https://github.com/LJP-TW/JITHook and slides deck: https://jsac.jpcert.or.jp/archive/2023/pdf/JSAC2023_1_4_chang_en.pdf |
I spent some time looking at the reverse. There are lots of issues to overcome. Firstly, and most importantly, Pyjion only uses RyuJIT. We never initialise the managed .NET runtime. That in itself is a huge undertaking. |
I see, understand it better now. Thank you! |
Hy! My scenario is to use a rather simple Python function from .NET.
As far as I understood, this is what Pyjion does anyway: produces IL and saves a .NET assembly. Is it possible to obtain this assembly / clean way of calling it from C# / .NET? Does Pyjion provide an explicit API of exporting a Python function to a .NET assembly?
Thanks!
The text was updated successfully, but these errors were encountered: