Thank you Bob. I have just started to learn SWIG and had some success with wrapping simple .dll.

 

I will work with developers on the API we need for testing, so I might be able to influence how the .h file look like. Is there anything I need to watch for so as to make my life easier in generating Python extension? Any part of the user guide I should pay close attention to? It’s a huge document…

 

Thanks,

Eileen

 

From: Bob Hood [mailto:bhood2@comcast.net]
Sent: February-24-11 11:57 AM
To: swig-user@lists.sourceforge.net
Subject: Re: [Swig-user] What's the best way to expose C++ APIs to Python (Windows)

 

On 2/24/2011 11:30 AM, Eileen Wei wrote:

Hi,

 

I am a software tester and I am exploring ways to exposing APIs of Windows applications that's developed in C++ and MFC to Python for testing purpose, because I'd like to test below the GUI level.

 

By googling, the most talked about I found are SWIG, Boost::Python and SIP. I am guessing users of this group might have done some research on this topic before choosing SWIG, and I would really appreciate any sharing of insight or experience about it.



Of the three, I would say that SWIG is your best bet.  It's greatest strength in comparison to the others is its ability to automatically parse C/C++ headers and code to generate wrappers for you.  For simplified wrapping, this greatly reduces the amount of maintenance required on your part whenever the API you are wrapping changes.

If you end up getting into complex wrapping situations, though, you might run into issues (and this may be the case for all three, not just SWIG).  There are situations that the documentation does not cover, and then your only recourse is to seek help here on this mailing list, and hope that you've not gone so far off the reservation that nobody can help.  I've hit that a couple of times, and have had to suspend my efforts as a result.