4 ms·
Swig is an interesting piece of work. As a project I think it's quite brilliant, I wrote a one-part-of-three-but-never-finished-the-other-two blog post illustra
by nickelpro 3y ago
Swig is an interesting piece of work. As a project I think it's quite brilliant, I wrote a one-part-of-three-but-never-finished-the-other-two blog post illustrating how nifty I thought it was [1].
In my old age though I've soured on it a little. The original problem I used it for, generating bindings for hundreds of generated pure aggregate data structures (for a serialized data format), is kinda SWIG's best case scenario.
The more complex (or more modern) your code gets, the more involved the types, the more the inherent complexity of the problem will overwhelm even the mighty SWIG and you'll find yourself wishing to use the native C ABI of whatever language you're binding to.
That said, if you're trying to generate bindings for several languages, I think working with SWIG still might be a worthwhile effort.
[1]: https://blog.vito.nyc/posts/swig-part1/ https://blog.vito.nyc/posts/swig-part1/