On 7/24/2011 1:34 PM, Bob Hood wrote:
I just discovered the $symname special typemap variable, and it looks like that would provide the conversion context I'm after, but it doesn't appear to work for Director typemaps, just standard typemaps.  When I use it in a standard typemap, it substitutes properly in the generated wrapper code.  However, if I use it in a Director typemap (e.g., "directorin"), SWIG passes it through to the wrapper code verbatim ("$symname").

Is this another 2.0.4 bug?

Actually, looks like an omission.  I looked at the code, and there's no actual substitution taking place with Director methods.  Seems easy enough to patch it to make it work.  I put in this code:

    [...]
    /* wrap complex arguments to PyObjects */
    String *symname = NewStringf("%s_%s", classname, pyname);
    Replaceall(wrap_args, "$symname", symname);
    Delete(symname);
    Printv(w->code, wrap_args, NIL);
    [...]

and my Director typemap now substitutes "$symname" with a "<class>_<method>" string using this.  Is there some reason why it has never been added to the python.cxx module?