Hooking into another program #3
-
Before I state my question, I need to provide some context: I am a fan of doing things in Python that you aren't supposed to do in Python. Today, I am trying to write a mod for the game Geometry Dash using Python, even though you would normally use C++. I honestly don't care how ridiculous this idea is because it's just really cool. The way that GD mods work (from my understanding) is that you have a modloader, which loads the mods. The mods which have an extension of Now sorry if this is an obvious or dumb question (I'm new to Cython), would it be possible to do something like this with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Should be possible. A module written in Cython is just a normal extension module after compilation (In Windows, a It can be done either using a system installed Python on The embeddable distributions of Python for Windows are available in their download page: https://www.python.org/downloads/release/python-3110/ (Docs: https://docs.python.org/3/using/windows.html#windows-embeddable). The difficult bit would be handling the loading of the correct Python, statically at compile time, or dynamically at runtime, with how Windows searches and loads DLLs. In a nutshell, you will need to have Python somewhere where the static import in your DLLs or runtime You can also look at pybind11 if you want a more C++ API to interact with Python. P.S. There is a lesser documented feature called isolation aware DLLs, which allows a DLL to search for it's own private dependencies packaged as SxS assemblies. Documentation for this sucks a bit though, and I'm not sure that will work well with extension modules. |
Beta Was this translation helpful? Give feedback.
Should be possible. A module written in Cython is just a normal extension module after compilation (In Windows, a
.pyd
file, which is a DLL that Python loads dynamically and calls back to the Python DLL), and Python can be embedded into host applications using its C API. https://docs.python.org/3/extending/embedding.htmlIt can be done either using a system installed Python on
PATH
(I don't remember if user installation are onPATH
for library loading, but could be done with them if they are as well), or the embeddable Python distribution for WindowsThe embeddable distributions of Python for Windows are available in their download page: https://www.python.org/downloads/release/python-3110/…