[C++-sig] [Swig-user] How to wrap a existing DLL to a python module?

William S Fulton wsf at fultondesigns.co.uk
Sun Apr 29 10:09:47 CEST 2007


Bruce Who wrote:
> Hi,
> 
> Another question, what i do now is wrap all functions in DLL again like this:
> 
> // this is header file for DLL
> void func(void)
> {
>     ...
> }
> 
> // this is my .cpp file for swig
> #pragma comment(lib, "TEVlib.lib")
> 
> void _func(void)
> {
>     func() // this is the func of DLL
> }
> 
> // this is .i file
> %inline{
> extern void _func(void);
> %}
> 
> I just wonder if it is possible that we can generate a .py file
> directly from the header file of DLL with all functions exposed? I
> think that can save a lot of time. I have tried without success.
> 

Er, this is one of the things that SWIG is designed to do. Take a look
at %include.

William



More information about the Cplusplus-sig mailing list