Reputation: 1125
I have read some docs from SWIG documentation (related to c++ code), but can't figure out if it is possible to genereate Python extension module in case I have compiled dll (no source code provided) and header file with all functions declared in dll.
If someone has the same problem and solve it, could you provide some useful example?
Thanks in advance.
Upvotes: 6
Views: 3812
Reputation: 177481
Yes, it is possible. SWIG only uses the headers to generate wrapper functions. Here's a simple SWIG file:
%module mymod
%{
#include "myheader.h"
%}
%include "myheader.h"
Then:
swig -python -c++ mymod.i
Then compile and link the generated code as a Python extension DLL. You will also need to link in the .lib for the wrapped DLL.
Upvotes: 6