[psoc-2008] Math::GSL arrayref swig typemaps
Eric Wilhelm
scratchcomputing at gmail.com
Mon Jun 30 19:03:50 UTC 2008
# from Thierry Moisan
# on Sunday 29 June 2008 13:07:
> int gsl_fft_complex_radix2_forward (gsl_complex_packed_array data,...
>
> typedef double * gsl_complex_packed_array ;
>
> I wonder how to write a typemap for getting the data variable in
> input in a way that I could use this function in this way:
> $x = gsl_fft_complex_radix2_forward (@data, $stride, $n);
You'll probably want @data to be passed as an arrayref if it is the
first argument:
$x = gsl_fft_complex_radix2_forward (\@data, $stride, $n);
Then I think your typemap needs to allocate a gsl_complex_packed_array
and deref the SV holding \@data, then step through that AV to transfer
the values into the gsl array.
The 'argout' typemap for arrays should basically be doing that in
reverse.
Sorry that's about all I can contribute to it at the moment, but perhaps
another mentor with some time and swig/XS knowledge can help here. If
you can get swig to generate some XS which isn't working, help on that
might be easier to find.
Unfortunately, it never seemed to me like the swig mailing list had many
perl users. Anybody have a thought on what the best perl mailing list
for this sort of question would be? The Inline list maybe?
--Eric
--
"But as to modern architecture, let us drop it and let us take
modernistic out and shoot it at sunrise."
--F.L. Wright
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
More information about the psoc-2008
mailing list