Creating .dll from a Python file
Question: > **Possible Duplicate:**  
>  [py2exe to generate
> dlls?](http://stackoverflow.com/questions/550446/py2exe-to-generate-dlls)

I'm searching for a way to make a .dll-file out of a python file. I also
wonder if I can use the functions in the dll from an another language like C++
oder Assembler? I have been looking at py2exe and pyapp, but it doesn't
provide porting to dll.

I'm sorry for this question. I feel sorry because I didn't search
StackOverflow before for similar questions / possible duplicates .


Answer: You can compile multiple python scripts into an assembly using clr.

    
    
    import clr
    clr.CompileModules("modules.dll", "module.py", "module2.py")
    

This is IronPython, but to reference these modules from other languages (ex.
C++ or C#) IronPython would be preferable in my opinion because it runs as a
.NET interpreter that can be understood by other languages that implement .NET

To reference the compiled dll from another IronPython script, for example:

    
    
    import clr
    clr.AddReference("modules.dll")
    

