-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Document how to embed Cython modules in C/C++ applications #3510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I created a stub page in https://github.com/cython/cython/blob/master/docs/src/tutorial/embedding.rst – improvements welcome! |
hi, |
Sure, investigation and PRs welcome. |
https://github.com/cython/cython/blob/master/Demos/embed/Makefile#L38 I think this embedded.c file got removed... |
Oh ok. I'm still unsure if that .msc can be used in visual studio. I'm also confused if a cython module requires compilation each time it's edited, or if cython effectively still interprets a .py script at runtime though python runtime. I'm guessing cython acts as some kind of glue, but I'm not sure I understand. The context being I want to use python a scripting language for a game, and I don't know if cython can help for this or not. |
Cython translates your code into a set of C functions which use Python's C-API to do all the operations. Cython doesn't really help in executing scripts at runtime, though you could use it to make the extension modules to provide access to your game in Python code. You'd really want to just use |
Please don't use the bug tracker for general discussions. We have the cython-users mailing list for this.
|
FWIW I have a working example of how to call I suspect this comes under
though
I remain sceptical of whether embedding Cython in C/C++ applications is actually useful (because people expect it to embed their module and all its dependencies), but multi-phase init is definitely something that people fight with, and additional ways to work with it are probably good. |
Is this open? |
@sohampirale yes I think the documentation here could still be improved. I couldn't tell you exactly what needs doing though |
The documentation on embedding is inherently lacking. Even the one in the CPython docs is incomplete at best.
There are some hints in the Wiki, there's the
--embed
option to thecython
andcythonize
frontends, the embedding demo, thePyImport_AppendInittab()
function in CPython and the documentation of the module init function in CPython.All of these are incomplete and none of them gives the whole picture in one place. There should be a dedicated documentation page in the Cython docs for this, and the documentation in the CPython docs is also worth improving.
The text was updated successfully, but these errors were encountered: