6

Hi does anyone know if you can compile Python code into a Windows DLL file? How would you go about doing this?

2
  • I've found a way to compile to EXE using py2exe. But still looking for way to make DLL. I want to use the DLL in a C# project. Commented Mar 18, 2011 at 12:29
  • 2
    From your comment I guess you want to integrate Python with .NET. If so, there's IronPython, which goes much further than just creating a DLL. Commented Mar 18, 2011 at 13:42

1 Answer 1

5

One way would be to create a C or C++ library that embeds the Python interpreter and runs your Python code.

Another option would be to translate you Python code to C++ with ShedSkin and make that a DLL, although I wouldn't expect a very clean API to come out of this.

Sign up to request clarification or add additional context in comments.

1 Comment

+1: Option 1 is the way it's supposed to be done. Just embed Python in your app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.