byneri
byneri

Reputation: 4240

Can python SWIG bind a library in the absence of the library's source code?

The software tool SWIG can be used to create a programming interface (bindings) to C/C++ software for other languages.

Interfacing to a C library works fine when the original C source code is available, from which one compiles .so files. The sample commands are listed in the SWIG python documentation: http://www.swig.org/Doc2.0/SWIGDocumentation.html#Python_nn7

However, in my case the 3rd party C library does not come with source files, only the header files. It comes with .dylib files under Mac OS X, and not .so files.

Is it possible to create a python module with a binding to this C library?

Upvotes: 1

Views: 324

Answers (1)

Alok
Alok

Reputation: 3290

For SWIG, header files are enough to generate the interface files. Though I haven't worked on MacOS, so not sure on how to link those libraries. But regarding your first question, you dont need the source code of a library to swig it to c/c++.

Upvotes: 1

Related Questions