How do I compile a Python class into a DLL so I can import it into C ++, using Python features that are not available in C ++?
I want to be able to import it without having Python installed on the computer
How do I compile a Python class into a DLL so I can import it into C ++, using Python features that are not available in C ++?
I want to be able to import it without having Python installed on the computer
Python is not a compiled language, it is an interpreted language, ie even programs like py2exe or cx_freeze send a stand-alone version of Python together.
with the "compiled Python" version in EXE and the source (or pyd
that is a intermediate language) of Python is probably internal (depends on each program, I do not know them in depth).
In other words, it is kind of impossible to create a .dll from a Python application that does not need Python, unless there is a Python to C or C ++ converter that is actually compiled, but it would be fine complicated, the work would be so much that it might not even be worth it, it would be easier to write in C ++ itself.
I can almost say that the absence of certain functionality in C ++ that you are supposed to have in Python can be obtained through .libs or even sources you will find in repositories.
There are also programs with a very advanced amount of functionality for C ++ like the link that has both open-source and enterprise versions. The Qt has IDE, SDK and optional features, compiles for Mingw, MSVC, GCC, has port for Android, iOS ie it is a cross-platform SDK.
I assume that your reason for doing this is not "absence only", but rather your familiarity with the language and with projects developed in it, you should know Python well but not C ++ and you are probably wanting to write in Python for already knowing, then I tell you that this path (from my point of view) is the one of the stones, I suggest you or choose to write everything in Python yourself and use programs like:
That will create an executable of your script including a "stand-alone python"
Or you might venture into Qt, which has lots of functionality in a simplified way to accomplish many things and is still cross-platform.