From: William S F. <ws...@fu...> - 2011-03-08 20:00:29
|
On 08/03/11 03:59, John Tardif wrote: > Hi, > simple question (c++ -> perl) - haven't been able to find this in any of > the available doco; I want apply the ***same argument name*** to both an > INPUT and an OUTPUT typemap. I have two c++ functions one returns an > argument (vector) and the other takes the return as input - with the > same argument name used in both functions something like this: > > int getInodes(inodeVector_t&inodes, > uint16_t flag); > ***returns a vector of inodes; > > int setInodes(inodeVector_t&inodes, > uint64_t file_size, > uint16_t flag); > ***takes the vector as input. > > So is it possible to apply&inodes to both INPUT and OUTPUT typemaps? > Actually one applies typemaps to variables, not the other way round as you mention. If you want to apply different typemaps to parameters that have both the type and variable name the same, then you need to put this into the appropriate place. For example: %apply int OUTPUT { inodeVector_t&inodes }; int getInodes(inodeVector_t&inodes, uint16_t flag); %apply int INPUT { inodeVector_t&inodes }; int setInodes(inodeVector_t&inodes, uint64_t file_size, uint16_t flag); If the method declarations are in a header, you'll have to modify the header. Otherwise it gets very hard. You could %ignore the functions, then redeclare them outside the header with unique variable names. William |