From: Alan W. I. <ir...@be...> - 2011-04-21 19:22:03
|
On 2011-04-21 09:37-0600 Eileen Wei wrote: > Hi Alan, > > Thank you for your suggestion. > > Actually that's exactly what I did initially, all I had in the interface file were a list of %apply and then %include "header.h", which worked very well for me. > > However, the developer of the header file didn't like this approach, he doesn't want to change the functions argument names, that's why I am exploring if there is any other way to write the interface file so I don't need to touch the header file. > > I am pretty new to SWIG but I thought it would be natural to expect that we can tell SWIG to wrap a header file using its default behaviour but can also specify some changes for certain functions - I am a little disappointed that that's something not supported. > > So is it that either we change the header file or we abandon SWIG? Hi Eileen: Another alternative which we use is to copy the header file, but change the names of function arguments in that file according to the type of argument. Of course, that adds a potential maintenance issue, but that has not been an issue for us. My guess is your two alternatives and mine are your only choices because my impression is that SWIG works on arguments rather than functions. But I could be wrong and there could be other alternatives. I am just an intermediate SWIG user who found that the approach of copying the header and modifying argument names worked well for us. Thus, real SWIG experts should comment here if there are other alternatives. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |