Zot Ditz Myo
Zot Ditz Myo

Reputation: 93

Exposing C++ library to Python + PIL

I started using SWIG on a huge C++ library (made of of several inter-dependent static libs) to expose it to python. This library defines many primitive classes that are used throughout as parameters (images of different types for example). There is extensive use of STL, inheritance and templating in the lib as well.

So far I have a minimal portion of the lib usable from Python but would like to progressively add the remaining 90+%.

For my part, working with SWIG is really no fun: Battling with template instantiations, learning all that SWIG syntax and keywords, etc. I recently played a bit with CTypes and found it so enjoyable that I am now considering writing an extern C interface for the whole library instead of using SWIG.

I would rather be coding in C/C++ and/or Python than learning an obscure set of SWIG commands (that counts for SIP also).

There are quite a few questions out there already asking similar advice so I'll add something new and specific:

I would like for the library's internal images classes to be visible from python as PIL images transparently, not as SWIG-Wrapped native classes. Will I have to resort to the plain-old Python External API to accomplish that?

I welcome any and all advice!

Upvotes: 3

Views: 1090

Answers (1)

Ken Smith
Ken Smith

Reputation: 805

Have you considered looking into using Boost.Python?

Upvotes: 1

Related Questions