Wrap C++ functions for Tcl with Typemaps

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Wrap C++ functions for Tcl with Typemaps


I'm a Newbie in SWIG and a Beginner in C++ and have some Problems wrapping C++ functions for Tcl/Tk. Assumed I have a function like this:
bool doSomething(int value1, float &result1, float &result2, float &result3) const;

I would like to call this function from Tcl this way:

    set list [doSomething $value]

In this Tcl-list the three return and the bool values should be stored. Here are my Typemaps in the .i file:

    %typemap(in,numinputs=0) float & (float temp) {
        $1 = &temp;

    %typemap(argout) float & {
        Tcl_AppendResult(interp, *$1);

By running my Tcl-Script this error is shown:

    "Wrong number of arguments doSomething self value1 result1 result2 result3 argument 3"

It would be nice if someone can help me. Sorry for my bad English.