I got most of your points.
I am still confused with TA_RetCode
I am being bugged by the compiler
C:\talib\ta-lib\swig\ide\msvc\talibruby\rubytalibdll
\rubytalib_wrap.c(1623) : error C2065: 'TA_RetCode' : undeclared
identifier
How do I make SWIG aware of my TA_Retcode type?
am I making some mistake pertaining to header inclusion in .i file ?
a snap of my wrap fn
===========================================
==========================================
SWIGINTERN VALUE
_wrap_TA_MA(int argc, VALUE *argv, VALUE self) {
int arg1 ;
int arg2 ;
double *arg3 ;
int arg4 ;
int arg5 ;
int *arg6 = (int *) 0 ;
int *arg7 = (int *) 0 ;
double *arg8 ;
TA_RetCode result; /* I did not get it here */
int val4 ;
int ecode4 = 0 ;
VALUE vresult = Qnil;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc);
SWIG_fail;
}
{
Check_Type(argv[0], T_ARRAY);
/* Get the length of the array */
int size = RARRAY(argv[0])->len;
int i;
arg3 = (unsigned char*) malloc(size * sizeof(double));
arg2 = size;
arg1 = 0;
// copy the ruby array in the new allocated buffer
/* Get the first element in memory */
VALUE *ptr = RARRAY(argv[0])->ptr;
for (i=0; i < size; i++, ptr++)
{
/* Convert Ruby Object Fixnum to unsigned char */
arg1[i]= NUM2DBL(*ptr);
}
}
ecode4 = SWIG_AsVal_int(argv[1], &val4);
if (!SWIG_IsOK(ecode4)) {
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "TA_MA"
"', argument " "4"" of type '" "int""'");
}
arg4 = (int)(val4);
{
int out_beg_ix = 0;
int out_n_ele = 0;
double arr_res[400];
arg5 = NUM2INT(optInMAType);
arg6 = &out_beg_ix;
arg7 = &out_n_ele;
arg8 = arr_res;
}
result = TA_MA(arg1,arg2,(double const
(*))arg3,arg4,arg5,arg6,arg7,arg8);
{
int iStartIx = *arg6;
int iLen = iStartIx + *arg7;
VALUE arr = rb_ary_new2(iLen);
for ( int i = iStartIx; i < iLen; i++ )
rb_ary_push(arr, INT2FIX((*arg8)[i]));
vresult = arr;
}
return vresult;
fail:
return Qnil;
}
Thanks
Regards