Hi all-

I didn't use your code right the first time. I didn't know I needed to code
tcl api stuff in the typemap.

Now I took an example from here: SWIG and Tcl
<http://www.swig.org/Doc1.1/HTML/Tcl.html>

and put it right in my interface file and c file.

Is someone out there in TCL sphere that can confirm this behavior in the
newest swig 4.0.2?

TypeError in method 'mypow', argument 3 of type 'double *'

%module korn
%include "std_vector.i"
%include "std_string.i"
%include "typemaps.i"
#ifdef SWIG<tcl>
%typemap(argout) double *outvalue {
char temp[TCL_DOUBLE_SPACE];
Tcl_PrintDouble(interp,*($source),dtemp);
Tcl_SetVar(interp,$arg,temp,0);
}
%typemap(in) double *outvalue {
static double temp;
$target = &temp;
}
#endif
%{
/* Put headers and other declarations here */
int mypow(double a, double b, double* outvalue);

%}
int mypow(double a, double b, double* outvalue);

int mypow(double a, double b, double* outvalue) {
    if ((a < 0) || (b < 0)) return -1;
    *outvalue = pow(a, b);
    return 0;
};
_______________________________________________
soci-users mailing list
soci-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to