# Ta-lib porting with swig

**URL:** <https://www.ruby-forum.com/t/ta-lib-porting-with-swig/88661>\
**Category:** Ruby\
**Created:** [March 13, 2007, 11:55am UTC](https://www.ruby-forum.com/t/ta-lib-porting-with-swig/88661 "2007-03-13T11:55:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BENI](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BENI](https://www.ruby-forum.com/u/BENI)\
**Post date:** [March 13, 2007, 11:55am UTC](https://www.ruby-forum.com/t/ta-lib-porting-with-swig/88661/1 "2007-03-13T11:55:49Z")

</div>

I have a function in c from ta-lib (TA-Lib provides common functions  
for the technical analysis of financial market data)  
[http://ta-lib.org/](http://ta-lib.org/)

function header

# ======= TA\_RetCode TA\_MA( int startIdx, int endIdx, const double inReal[], int optInTimePeriod, int optInMAType, int \*outBegIdx, int \*outNbElement, double outReal[], )

In c it is called as

==========  
TA\_Real closePrice[400];  
TA\_Real out[400];  
TA\_Integer outBeg;  
TA\_Integer outNbElement;

/\* … initialize your closing price here… \*/

retCode = TA\_MA( 0, 399,  
&closePrice[0],  
30,TA\_MAType\_SMA,  
&outBeg, &outNbElement, &out[0] );

# /\* The output is displayed here \*/ for( i=0; i \< outNbElement; i++ ) printf( “Day %d = %f\n”, outBeg+i, out[i] );

i was wondering how will the typemap in SWIG look like for arguments

const double inReal[]  
int \*outBegIdx  
int \*outNbElement,  
double outReal[],

=============

can any one help me out by giving some lead?

regards
