I'm learning to use Inline::Pdlpp and I have several questions. Many fortran
subroutines modify their arguments, which are passed by reference. If I
call such a function with code such as
PDL::myfun($a, $b);
use Inline Pdlpp =><<'ENDPP'
pp_def('myfun',
Pars=>'a(); 'b(n);',
Code=>'mysub_($P(a), $P(b), $SIZE(n));'
);
ENDPP
can I be sure that the pdl's $a and $b (on the perl side) will be
modified if 'mysub_' modifies its first two arguments, or that they will
not be modified even if mysub_ does modify its arguments?
On the other hand, if the subroutine has many arguments and modifies
several of them, what is the best way to send back the modifications to
perl (easiest but not too inefficient)? I guess I could copy the
variables to output variables using something like
Pars=>'...b(n);... [o] c(n);...',
Code=>'
mysub_($P(a), $P(b), $SIZE(n));
...
loop(n) %{ $c()=$b(); %}
...
'
Would this work? This is related to the previous question: will $b()
(on the PP side) contain the changed values after returning from the
Fortran subroutine? In case this works, wouldn't it involve too much
copying? Is there a better/recommended way of sending the changes back
to the perl side?
One last question. Is there a simple way of sending back values that
are not in a pdl?
(Maybe all the questions could be answered with a pointer to the
relevant documentation.)
Thanks and best regards,
Luis
--
o
W. Luis Mochán, | tel:(52)(777)329-1734 /<(*)
Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\
Apdo. Postal 48-3, 62251 | (*)/\/ \
Cuernavaca, Morelos, México | [email protected] /\_/\__/
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl