|
|
|
|
|
by lloeki
5405 days ago
|
|
SWIG worked wonders for me too when we had to iteratively lift a dependency on a proprietary ISAM C library in a critical application. The worse we had to do was to handle a bunch of corner cases due to some non-null terminated string handling and be wary of a silly global var which could have bitten us otherwise when multithreading. The extend functionality was awesome to make structs more object-oriented by adding a few key methods. The key was to handle the resulting Python module as a low level C wrapper effectively allowing us to write "managed C" in Python, which we encapsulated neatly in a library with a much more pythonic API. We then naturally went all the way up and implemented SQL-like API (no parser, just methods) and a Django model subset. A SQL subset parser and DBAPI compliance were planned features. All of that allowed us to develop new features in Python and on Django while maintaining compatibility with the old components (also thanks to Django multi-db support) and making the planned switch to a complete SQL database a drop-in replacement. |
|