Brent, Thanks for the quick response. That helped a lot. What would I need to do differently if instead of having the header file and the implementation file (cpp_rect.h & cpp_rect.cpp), I instead had the header file and the object file (cpp_rect.h and cpp_rect.o)? Thanks, ~Luke
On Tue, Mar 10, 2009 at 2:51 PM, Brent Pedersen <[email protected]> wrote: > i'm sure it doesnt answer all your questions, but here's how i built > and used the cpp example, it required some code changes. > i uploaded to wiki, but didnt link to it directly. > it has a Makefile and example usage script. > > http://wiki.cython.org/WrappingCPlusPlus?action=AttachFile&do=get&target=cythoncpp.tgz > > -brent > > On Tue, Mar 10, 2009 at 2:33 PM, Luke <[email protected]> wrote: >> I'm trying to wrap some basic C++ code. I tried to follow the >> directions on the wiki, but I found them to be unclear and incomplete. >> I also noticed a thread about this on Cython-dev, but it doesn't seem >> to have been resolved. As a total rookie with Cython and wrapping >> code in general, it would be nice to have a step by step example of >> the process that is illustrative of how to wrap a C++ library, >> including: >> >> 1) Source of the header file (Rectangle.h) >> 2) Source of the implementation file (Rectangle.cpp) >> 3) Source of the setup file (setup.py) >> 4) Source of the ??? file (Rectangle.pyx) >> 5) shell commands necessary prior to being able to import the >> Rectangle class into python >> 6) example of using the wrapped C++ library inside the python interpreter >> >> Things that were not helpful in the setup.py were things like: >> include_dirs=[...], # usual stuff >> libraries=[...], # ditto >> extra_link_args=[...], # if needed >> >> As an example of how to wrap a C++ class, I don't think extras that >> aren't well explained help the situation. From the wiki, it wasn't >> clear what exactly belonged in the .pyx file. It would be nice if >> this could be clarified. >> >> I think I can piece together steps 1), 2), 3) from the wiki and from >> the previous thread on the subject, but steps 4), 5), and 6) are still >> unclear to me. It would be a great help if these steps could be shown >> explicitly. Can anybody help me out on how to do this? >> >> Thanks, >> ~Luke >> _______________________________________________ >> Cython-dev mailing list >> [email protected] >> http://codespeak.net/mailman/listinfo/cython-dev >> > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
