Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python to DLL
#1
Hi, Python Forum Smile

I'm a new member here. And also new in Python.
My name is Stephanus, you can call me Steven, from Indonesia.

I would like to know if we can compile Python to DLL file.

def my_function(x):
return(x * 2)



Suppose I have a very simple function like that one above.
How can I compile it to .DLL so that I can call it in Delphi or C.

Thank you very much.
I'd really appreciate your help.
Reply
#2
It does not work exactly this way. C programs that execute Python code load the Python library which contains a whole set of C functions to communicate with the Python interpreter.

Start by reading Extending and Embedding the Python Interpreter (obviously the «embedding» part is what you are looking for), then have a look at the Python C Api reference manual.
tcomponent likes this post
Reply
#3
(May-25-2022, 07:08 PM)Gribouillis Wrote: It does not work exactly this way. C programs that execute Python code load the Python library which contains a whole set of C functions to communicate with the Python interpreter.

Start by reading Extending and Embedding the Python Interpreter (obviously the «embedding» part is what you are looking for), then have a look at the Python C Api reference manual.

Thank you very much Gribouillis
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020