0

I want created python file as dll file .I already created exe file using py2exe package . but i want dll file. How can I convert python file into dll file?

pavel
  • 26,538
  • 10
  • 45
  • 61
Nandha Kumar
  • 413
  • 8
  • 18
  • What are you trying to achieve in creating a dll? – user3419537 Jul 09 '14 at 12:34
  • I searched google .but i cant get any idea about convert dll file. some people refer py2exe .but i can get only exe file – Nandha Kumar Jul 09 '14 at 12:36
  • 2
    Yes, but why do you need a dll? Do you need to distribute a library? Are you simply trying to include Python code in a C/C++ application? I don't believe creating a dll from Python code is a trivial task. There may be a better alternative depending on what you need to do. – user3419537 Jul 09 '14 at 12:48
  • yes i need to implement my python file in c#,c,C++ language – Nandha Kumar Oct 31 '14 at 10:01
  • 2
    Consider [embedding the Python interpreter](https://docs.python.org/2/extending/embedding.html) in your program. Depending on what you need to do, it may be as simple as a call to `PyRun_SimpleString()`. – user3419537 Oct 31 '14 at 12:35
  • 1
    have a look here [How to compile a Python package to a dll](https://stackoverflow.com/q/10859369/2601521) – Ohad Cohen Feb 21 '21 at 22:50
  • 1
    Does this answer your question? [How to compile a Python package to a dll](https://stackoverflow.com/questions/10859369/how-to-compile-a-python-package-to-a-dll) – Ohad Cohen Feb 21 '21 at 22:51

1 Answers1

-5

Just use "open" command!

a = open("file.dll", "w")
a.write("something")
a.close()
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
DanTV
  • 1
  • 1
    Whilst this will create a file with the dll extension, it will not create a valid dynamic link library... the asker seems to want to create a library from their python code that can be linked to. – Matt Coubrough Feb 12 '17 at 08:36