Can you embed Python into a C program and then call it from C#/ASP.NET with no outside tools?
I got a question about embedding P开发者_运维问答ython into C/C++ programs. I'm new to .NET and C sharp, and
I was recently able to call a few dlls (one simple hello world C I made from scratch with the help of Vladimir Tskhvaradze's 05 how to, and a user.32 out of the 70-536 book).
I see in my Python documentation 2.6 that I can embed Python into C/C++.
Is it possible to then call this newly created C program("module"?) with the Python embedded (code and Im assuming interpreter) from ASP.NET/C sharp and have it all coexist peacefully in .NET?
I see different tools etc...but I wanna know straight out the box can I do this. Also how much would using Visual Studio C++ 08 or 10 help/hinder this process?
I recommend to use COM: write a COM server in Python (using win32com), and then access it from C# (using .NET's COM interop). You should start with a hello-world style application, to make sure it can work at all. This should not require any additional tools, and no C code.
精彩评论