#47 %typemap(directorin) features

Bill Spotz

In the python documentation for director typemaps, the statement is made that it is not clear what features are needed. I have been playing with them recently, and have some suggestions for %typemap(directorin):


Allow declaration of local variables. That is, allow

%typemap(directorin) TYPE1 (TYPE2 localvar) {...}

where localvar (with $argnum suffix) gets declared outside the typemap scope. I have had the situation where I need to create an intermediate variable before constructing the PyObject that gets sent to the director function/method. It needs to exist through the function call, and this would put it on the stack and have it be deleted automatically.


Allow numinputs qualifier. In conjunction with the directorargout typemap, this will help create a cleaner interface for the python user when a C/C++ argument is output only and the python interface moves this argument to the output tuple. For example,

%typemap(directorin,numinputs=0) TYPE1 { }
%typemap(directorargout) TYPE1 {...}

The primary change would be to the argument list passed to the python function/method.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks