I am new to programming in python,but have programmed in C. I am working on a project called EtherDogs which is a network packet analyzer. How do I go about writing a python wrapper for the project ?
It would not be difficult if I had to do a C++ wrapper for it but how do I do it in python ?
You should try a wrapper generator like SWIG. Writing glue code by hand is repetitive and boring. Why not have the computer do the easy parts for you?
SWIG will take in your source files and a (minimal) interface specification. It'll produce Python proxy classes and C/C++ code. You compile the C/C++ code into a Python extension library, and then use it just like you would a pure-Python library. Under the hood, the proxy classes SWIG generates handle converting Python types to/from calls to the original C functions.
As an added bonus, wrapper generators (SWIG included) can usually create bindings for many different high-level languages with little or no additional effort on your part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With