How to compile a Python package to a dll How to compile a Python package to a dll python python

How to compile a Python package to a dll


Write everything you want to hide in Cython, and compile it to pyd. That's as close as you can get to making compiled python code.

Also, dll is not a standard, not in Python world. They're not portable, either.


You can embed python inside C. The real trick is converting between C values and Python values. Once you've done that, though, making a DLL is pretty straightforward.

However, why do you need to make a dll? Do you need to use this from a non-python program?


You can use py2exe.org to convert python scripts into windows executables. Granted this will only work on windows, but it's better then nothing.