Hi Craig,

I believe if you take a look at 
https://github.com/Perl/perl5/blob/blead/lib/ExtUtils/typemap#L241 you’ll see 
that’s what the XS machinery does for you with a T_PTROBJ (which is why I 
changed the GSL::INTERP stuff to use it rather than rolling its own, as 
previously) – the alternative is to use a T_PTR to keep it as a dumb 
integer/pointer. Let’s not duplicate what already works really, really well? :-)

It does seem to me that the PDL::PP doc could use expanding to include the 
example from GSL::INTERP. If anyone agrees, please either open an issue on PDL 
saying so, or even better a pull-request with the suggested doc snippet!

Best regards,
Ed

From: Craig DeForest<mailto:defor...@boulder.swri.edu>
Sent: 08 March 2022 17:29
To: Ingo Schmid<mailto:ingo...@gmx.at>
Cc: perldl<mailto:pdl-general@lists.sourceforge.net>
Subject: Re: [Pdl-general] otherpars and return value

I generally use the PMCode option and curry the argument into a ref on the Perl 
side, pass the ref into the PP code itself, and have the PP code manipulate the 
pointed-to value inside the ref (using SvRV).  Then the PMCode unpacks the 
pointer and returns the value.  Sort of a pain but it works.

[https://perldoc.perl.org/perlguts#References]


On Mar 8, 2022, at 10:09 AM, Ingo Schmid 
<ingo...@gmx.at<mailto:ingo...@gmx.at>> wrote:

Hi,
in which way can I pass back non-piddles from PP? Please provide a working 
example, I have tried for days and keep failing. See what I've tried so far. I 
can write to $COMP(p), use it either as value or pointer, all is well inside 
the Code=> part, but whatever I do is lost. I've tried passing as reference as 
well.
Ingo

<Test.pl>_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/pdl-general


_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to