I need to find some way to embed a C library and C code in python. I have looked all over and found a lot of embedding python in C examples but not very many visa versa. And I need to make sure I'm embedding the C, and not just re-wrapping it.
Thanks.
asked Mar 2, 2012 at 22:28
Brooks McMillin
311 silver badge2 bronze badges
-
3What do you mean by "embedding" vs. "rewrapping"?Niklas B.– Niklas B.2012年03月02日 22:33:24 +00:00Commented Mar 2, 2012 at 22:33
-
1Embedding C in python is done by writing python modules in C. I guess you don't like this way -- why?liori– liori2012年03月02日 22:33:31 +00:00Commented Mar 2, 2012 at 22:33
-
I believe you are looking for: docs.python.org/extending/extending.htmlPeter Olson– Peter Olson2012年03月02日 22:35:55 +00:00Commented Mar 2, 2012 at 22:35
1 Answer 1
Extending Python with C is straightforward, but not brief. There is an official tutorial titled Extending Python with C or C++ available here.
answered Mar 2, 2012 at 22:34
rob05c
1,2331 gold badge9 silver badges19 bronze badges
Sign up to request clarification or add additional context in comments.
3 Comments
rob05c
I'm not sure what you mean by "re-wrapping," but extending with modules is how you use C in Python.
fouric
Please do not post link-only answers! These may expire, and then your answer will be useless.
rob05c
@InkBlend I rephrased the answer to include the title of the tutorial, to make finding it easier if the link breaks. I'm not going to rephrase or copy significant portions of the article here, however. I believe that would be superfluous and possibly plagaristic.
default