3

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
3
  • 3
    What do you mean by "embedding" vs. "rewrapping"? Commented Mar 2, 2012 at 22:33
  • 1
    Embedding C in python is done by writing python modules in C. I guess you don't like this way -- why? Commented Mar 2, 2012 at 22:33
  • I believe you are looking for: docs.python.org/extending/extending.html Commented Mar 2, 2012 at 22:35

1 Answer 1

7

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
Sign up to request clarification or add additional context in comments.

3 Comments

I'm not sure what you mean by "re-wrapping," but extending with modules is how you use C in Python.
Please do not post link-only answers! These may expire, and then your answer will be useless.
@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.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.