Dear all,
 
I am sure that this is an FAQ but despite checking the archive, I can't find the answer.
 
I am trying to to use SWIG to access C arrays from C# and Perl. While I have had some success passing single values, I can't seem to pass the address of an array.
 
I have created a dll with a single function (Add2) that just adds the contents of 2 arrays and returns the results in a third. The DLL is in /dll, the batch file for building SWIG with Visual C++ V6 is in /SWIG and the c# test program is in /C#test.
 
Add2 is declared as :
 
void Add2 (const double * pSrc1,
           const double
* pSrc2,
           double *
pDst,
           const long
SampleLength);

With Visual C# I get the following result :
The sum of 3 and 7 is 10                                       *** Correct
The sum of two arrays :                                        *** Wrong
7
8
9
 
With Active Perl I get the following results :
 
Sum = 9                                                        *** Correct
 
Src Array 1 = 1.22.33.4
Src Array 2 = 4.55.66.7
RuntimeError Usage: Add2(INPUT,INPUT,long const);              *** Oops
 
 
Rather than clog up the list with all the code I have zipped it up and it can be downloaded from : http://www.numerix-dsp.com/SWIG/SWIG.zip.
 
I look forward to any suggestions and feedback.
 
Thanks very much,
 
John